在Windows 8应用程序中播放youtube视频

编程入门 行业动态 更新时间:2024-10-23 08:40:57
本文介绍了在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="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视频

本文发布于:2023-11-23 13:56:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621676.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   视频   Windows   youtube

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!