我一直试图在Windows 8 html5&中播放YouTube视频。没有运气的javascript应用程序!
I have been trying to play a youtube video in a windows 8 html5 & javascript app with no luck!
我尝试复制youtube提供的代码,用于在default.html的主体中嵌入视频,例如:
I tried copy pasting the code youtube provided for embedding videos in the body of default.html, for example:
<iframe width="420" height="315" src="www.youtube/embed/k07IaB9yq_U" frameborder="0" allowfullscreen></iframe>这会出现以下错误:
视频播放需要Adobe Flash播放器或支持HTML5的浏览器。 获取最新的Flash播放器了解有关更新HTML5浏览器的更多信息。
The Adobe Flash player or an HTML5 supported browser is required for video playback. Get the latest flash player Learn more about updating an HTML5 browser.
当我尝试使用带有上一个链接的视频标记时,例如:
when I try using the video tag with the previous link, for example:
<video src="www.youtube/embed/k07IaB9yq_U" controls></video>它说无效来源!
这样做的正确方法是什么?
What is the right way to do this?
谢谢
推荐答案YouTube有一个测试版程序可以提供HTML5中的一些视频。您可以此处加入。完成后,您应该能够通过导航到YouTube网址将HTML5 YouTube视频嵌入到WebView控件中。
YouTube has a beta program to provide some videos in HTML5. You can join it here . Once you have done that you should be able to embed HTML5 YouTube videos in a WebView control by navigating to the YouTube URL.
Flash视频无法在Metro风格应用中显示。
Flash videos cannot be displayed in a Metro style app.
webview控件的代码
Code for the webview control
string htmlFragment = @"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html> <head> <title>YouTubePagesample</title> </head> <iframe width='560' height='315' src='www.youtube/embed/{YoutubeID}' frameborder='0' allowfullscreen></iframe> <body> </body> </html>;"; this.webView.NavigateToString(htmlFragment);更多推荐
在Windows 8应用程序中播放youtube视频
发布评论