如何使用C#WPF中播放YouTube视频如何使用、视频、WPF、YouTube

2023-09-04 00:42:27 作者:刻你名在我心

我想在我的WPF应用程序播放YouTube视频。我使用谷歌的API,并成功获得有关视频资料,但我不`吨了解如何播放视频。这是我的code这是我用来检索信息。

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

thank`s

推荐答案

您将不得不使用WebBrowser控件 - 这里有一个例子: HTTP://www.$c$cproject.com/Articles/27121/Stream-YouTube-Videos-in-WPF

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 :)