Video not playing in Android

前端 未结 5 438
情歌与酒
情歌与酒 2020-12-30 12:33

Video not working properly in the below mentioned code. What could be the problem for this?

MediaController mediaController = new MediaController(getBaseCont         


        
5条回答
  •  忘掉有多难
    2020-12-30 13:09

    VideoView and Mediaplayer can play only formats given in the document Android Supported Media Formats.

    The link of the YouTube video you gave is for an HTML page. If you are playing an HTML page as mentioned by Karthik, it is better to use Webview.

    String url = "your_youtube_link";
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    

    If you want only the video to be viewed from that link, leave all other details in the page. Suppose this is the YouTube link http://www.youtube.com/watch?v=ZC7ZOGpM2cU&feature=g-logo&context=G233b464FOAAAAAAABAA

    If you parse the source of the YouTube HTML page, you may see this portion:

    
    
    
    
    
    
    
    
    
    
    
    
    
    

    In this, extract the following

    
    

    In this, the link will show it fullscreen.

提交回复
热议问题