3

I am writing application to show youtube videos. In WPF on windows 7 I use WebBrowser control and it works fine. But when I use WinRT WebView control to show swf file from youtube - it doesn't work. Only clear white screen.

I use approach like that : http://blog.tedd.no/2010/06/27/embedding-youtube-in-wpf-webbrowser-control/

What shall I do to have an oppotunity to show videos in Metro Style Application? Thank you

Alex
  • 842
  • 11
  • 33
  • See http://stackoverflow.com/questions/11491774/how-to-play-youtube-videos-in-a-windows8-html-javascript-app/11506960#11506960 – Rico Suter Nov 03 '12 at 01:57

3 Answers3

2

try this one from the mytoolkit library: http://mytoolkit.codeplex.com/wikipage?title=YouTube

Rafael Sanches
  • 1,823
  • 21
  • 28
1

The default youtube video player (unless the user has opted into the HTML5 preview) is a Flash video control. Flash is not supported in the Windows Application Store ("Metro") shell version of IE, or in the WebView control.

But what you can do is request youtube to use the HTML5 video player (HTML5 video is supported by the App Store version of IE and WebView). For example, this video does play properly for me:

    <WebView Source="http://www.youtube.com/watch?v=cTl3U6aSd2w&amp;html5=True" />

So you should be able to embed a video using a webview, you just have to force the webview to use the HTML5 viewer. This can also be done as a parameter to the embed URL: see Force HTML5 youtube video

However, this setting only says to prefer the HTML5 player. Youtube may still attempt to use the flash player on some videos, which will not work in all cases.

Community
  • 1
  • 1
Andy Rich
  • 1,942
  • 10
  • 14
1

You can alternatively also play the video through "mediaelement" to play youtube video, though you'd have to parse the youtube video stream first. See my W8 app "RedditTV"

Rohit Sharma
  • 6,136
  • 3
  • 28
  • 47