How to launch a YouTube URL on Windows Phone 7

后端 未结 7 2199
伪装坚强ぢ
伪装坚强ぢ 2021-02-04 20:23

I would like to launch directly to the YouTube player on Windows Phone 7.

I tried using WebBrowserTask and giving a YouTube URL, it opens up the browser and brings me t

相关标签:
7条回答
  • 2021-02-04 20:41

    No. Mabe in next version of OS will be custom choosers and lunchers.

    0 讨论(0)
  • 2021-02-04 20:42

    Once you have the Youtube app installed, from within you application you can start the WebBrowserTask and do the follwing:

            Regex Youtube = new Regex("youtu(?:\\.be|be\\.com)/(?:.*v(?:/|=)|(?:.*/)?)([a-zA-Z0-9-_]+)");            
    
            Match youtubeMatch = Youtube.Match(YOUTUBE_VIDEO_URL);           
    
            string id = string.Empty;
    
            if (youtubeMatch.Success)
                id = youtubeMatch.Groups[1].Value; 
    
            WebBrowserTask webBrowserTask = new WebBrowserTask();
    
    
            webBrowserTask.URL = "vnd.youtube:"+ id +"?vndapp=youtube_mobile";
            webBrowserTask.Show();
    

    That should launch the browser, then automatically launch the Youtube App. Cheers!

    0 讨论(0)
  • 2021-02-04 20:44

    To display a video from YouTube, you will need the Video Player for YouTube. Otherwise, you will need to write a custom decoder that will receive the YouTube stream and display it in a MediaElement.

    0 讨论(0)
  • 2021-02-04 20:48

    There is a solution for that now. You can use vnd.youtube protocol to launch the YouTube application from Microsoft and play.

    C#

     Windows.System.Launcher.LaunchUriAsync(
    
     new System.Uri("vnd.youtube:9bZkp7q19f0")
    
     );
    

    Unfortunately Launcher.LaunchUriAsync method only works with Windows Phone 8 devices and beyond.

    0 讨论(0)
  • 2021-02-04 20:49

    Try to use following sample;

      WebBrowserTask webBrowserTask = new WebBrowserTask();
      webBrowserTask.Uri = new Uri("http://www.youtube.com/embed/V3oJR5IAMxM?autoplay=1");
      webBrowserTask.Show();
    

    this should open video directly, but I think you will have to still double click to go back.

    0 讨论(0)
  • 2021-02-04 20:53

    Finally I've worked out a clean solution (without browser task, and no "double back key pressing"):

    http://mytoolkit.codeplex.com/wikipage?title=YouTube

    0 讨论(0)
提交回复
热议问题