How to launch a YouTube URL on Windows Phone 7

后端 未结 7 2235
伪装坚强ぢ
伪装坚强ぢ 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条回答
  •  旧时难觅i
    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!

提交回复
热议问题