问题
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