Windows Phone 上的 YouTube 与 MediaElement
这篇博文建议或许可以直接使用 Silverlight MediaEelement
播放 YouTube 视频。
<MediaElement HorizontalAlignment="Left"
VerticalAlignment="Top"
Source="http://www.youtube.com/get_video?
video_id=8yuIw_0ejLs&t=vjVQa1PpcFPrX3tFoahhu4DbniDIqTLkwybdm8xuCt8%3D&fmt=22"/>
我想知道这是否适用于 Windows Phone 7。我有一个基于播放 YouTube 上托管的视频的应用程序,如果能够更好地控制视频体验,而不仅仅是使用以下命令启动浏览器,那就太好了YouTube 视频网址。
This blog post suggests that it might be possible to play YouTube videos with the Silverlight MediaEelement
directly.
<MediaElement HorizontalAlignment="Left"
VerticalAlignment="Top"
Source="http://www.youtube.com/get_video?
video_id=8yuIw_0ejLs&t=vjVQa1PpcFPrX3tFoahhu4DbniDIqTLkwybdm8xuCt8%3D&fmt=22"/>
I was wondering if this holds true for the Windows Phone 7. I have an application that is based on playing videos hosted on YouTube, and it would be nice to be able to have more control over the video experience other than just launching the browser with the YouTube video URL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
除非您有视频内容的直接链接,否则无法在 Windows Phone 7 上显示 YouTube 视频。据我所知,
get_video
不再可供公众访问。Unless you have a direct link to video content, you cannot display YouTube videos on Windows Phone 7. As far as I know,
get_video
is no longer available for public access.引自 Windows Phone 开发人员常见问题解答
Quoting from the Windows Phone Developer FAQ
对于其他仍然好奇的人来说,需要克服的问题是获得视频的直接链接,这确实需要一些小技巧,但它非常可靠且易于做到。首先,您需要视频 ID,以便获得可以使用 youtube api 的 youtube url。然后做这样的事情。我几乎将用户脚本转换为 silverlight。
接下来的一点看起来很糟糕。
最后一位 itag==18 根据此选择质量
,现在您可以对链接执行任何您想要的操作,例如使用 mediaplayerlauncher 或 mediaelement 打开它。就我个人而言,我很想将其下载到独立存储中并同时播放,但目前看来说起来容易做起来难。感谢您抽出宝贵的时间,抱歉发了这么长的帖子。
For everyone else still curious the problem to overcome is getting a direct link to the video which does require a small hack but it's very reliable and easy to do. Firstly you need the video id so you can get the youtube url which you can use the youtube api for. Then do something like this. I pretty much converted a userscript to silverlight.
the next bit looks bad.
the last bit itag==18 selects the quality according to this
now you can do whatever you want with the link like open it with mediaplayerlauncher or mediaelement. personally i'd love to download it to isolated storage and play it at the same time but at the moment that seems easier said than done. thanks for your time sorry for the long post.
我确信您可以针对 Windows Phone 进行调整 http://www.codeproject.com/KB /WPF/YouViewer.aspx
I am sure you can adjust it for Windows Phone http://www.codeproject.com/KB/WPF/YouViewer.aspx