在Windows 8应用程序中播放youtube视频 [英] Playing youtube video in windows 8 app

查看:107
本文介绍了在Windows 8应用程序中播放youtube视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在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="http://www.youtube.com/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="http://www.youtube.com/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' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
            <html>
               <head>
                  <title>YouTubePagesample</title>
               </head>
               <iframe width='560' height='315' src='http://www.youtube.com/embed/{YoutubeID}' frameborder='0' allowfullscreen></iframe>
               <body>
               </body>
            </html>;";
        this.webView.NavigateToString(htmlFragment);

这篇关于在Windows 8应用程序中播放youtube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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