如何在 Windows Phone 7 上启动 YouTube URL [英] How to launch a YouTube URL on Windows Phone 7

查看:30
本文介绍了如何在 Windows Phone 7 上启动 YouTube URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想直接启动到 Windows Phone 7 上的 YouTube 播放器.

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

我尝试使用 WebBrowserTask 并提供一个 YouTube URL,它会打开浏览器并将我带到一个带有 YouTube 视频缩略图的页面,我需要在视频播放前点击缩略图.

I tried using WebBrowserTask and giving a YouTube URL, it opens up the browser and brings me to a page with a thumbnail of the YouTube video, I need to click on the thumbnail before the video plays.

我喜欢跳过额外的点击.我喜欢用户点击我的应用程序中的一个按钮,它应该直接播放视频.有办法吗?

I like to skip the extra click. I like the user to click a button in my app, and it should play the video directly. Is there a way to do it?

推荐答案

一旦您安装了 Youtube 应用程序,您就可以从应用程序中启动 WebBrowserTask 并执行以下操作:

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();

这应该会启动浏览器,然后自动启动 Youtube 应用程序.干杯!

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

这篇关于如何在 Windows Phone 7 上启动 YouTube URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆