Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to play a YouTube video in WPF using C#

I want to play a YouTube video in my WPF application. I am using Google API and successfully get information about video but i don`t understand how to play a video. Here is my code which is i used for retrieve information.

  YouTubeRequestSettings setting = new YouTubeRequestSettings("MyAPP", "ID");
  YouTubeRequest request = new YouTubeRequest(setting);
  YouTubeQuery myQuery = new YouTubeQuery(YouTubeQuery.MostPopular);
  myQuery.OrderBy = "viewCount";
  Feed<Video> videoFeed = request.Get<Video>(myQuery);
  foreach (Video item in videoFeed.Entries)
       {
          listBox1.Items.Add(item.Title);
       }

thank`s

like image 844
Vero009 Avatar asked Nov 29 '11 16:11

Vero009


People also ask

How do I embed a Youtube video in WPF?

string html = "<html><head>"; html += "<meta content='IE=Edge' http-equiv='X-UA-Compatible'/>"; html += "<iframe id='video' src= 'https://www.youtube.com/embed/{0}' width='640' height='360' frameborder='0' allow = \"autoplay; encrypted-media\" allowFullScreen></iframe>"; html += "</body></html>"; this. webBrowser1.

What is WPF in C# with example?

WPF, or Windows Presentation Foundation, is a UI (user interface) framework that creates desktop client applications. The WPF development platform supports a broad set of application development features, including an application model, resources, controls, graphics, layout, data binding, documents, and security.


1 Answers

You'll have to use a WebBrowser control - Here's an example: http://www.codeproject.com/Articles/27121/Stream-YouTube-Videos-in-WPF

Cut and past of what Mike posted as comment :)

like image 177
EKS Avatar answered Oct 03 '22 22:10

EKS