UWP youtube player in mediaelement

柔情痞子 提交于 2020-02-28 07:45:13

问题


I am currently developing an UWP youtube player and i am having some big trouble with playing the actual video. I am using this to play a youtube video in a media element:

  using MyToolkit.Multimedia;
var url = await YouTube.GetVideoUriAsync(youtubeid, YouTubeQuality.Quality1080P);
var YoutubePlayer = new MediaElement();
YoutubePlayer.Source = url.Uri;

It used to work just fine for about a month, but now it just... doesn't. It gets the right video URI (the mp4), i also tried with the YoutubeExtractor nuget package, but for some reason, when i use YoutubePlayer.Play(), it just doesn't play. It does nothing. No error, no nothing.

I found an alternative of using a webview and custom C# controls that calls javascript methods, but i prefer not to go that way, since it is much smoother having a media element.

Any help would do, i've been searching the internet for days now and still can't find an answer.

Thank you.


回答1:


A while ago i tried the same and i couldn't get youtubeExtractor to work. I then moved on to LibVideo - which did work.

This is a forked repo which implemented some fixes that were not accepted yet at the time. https://github.com/sommmen/libvideo

The project is no longer being maintained sadly, but this still works for me till this day.



来源:https://stackoverflow.com/questions/38011837/uwp-youtube-player-in-mediaelement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!