YouTube: Youtube not playing in UWP
Hello,
I am using the exact code:
try
{
var url = await YouTube.GetVideoUriAsync(
youTubeId, YouTubeQuality.Quality720P);
player.Source = url.Uri;
player.Play();
}
catch (Exception exception)
{
// TODO show error (video uri not found)
}
It worked for about 1 or 2 months for me, but now it just doesn't play anymore. It gets an uri, sets the player source (where player is a mediaelement), but when i call player.Play() nothing happens. No error, no nothing.
Did something change with their API? Is the uri not good? I can't figure it out why it just suddently doesn't play. Happens on multiple devices, multiple connection, tested it anywhere.
Also, takes way longer now for GetVideoUriAsync() to execute. Like 10 seconds+.... Used to be almost instant.
Maybe they changed the "API" again...
Yeah, i think so. This is the only way i can play a youtube video in a media element. I need to get that mp4 streaming link :(
The alternative is to use an embedded youtube player, but that kinda sucks, i already tested it and i get ads, i can't fullscreen it (or maybe i can if i struggle a little) and most important, i can't play it in a background audio task -.-
@darksody, Unless Microsoft fixed it, I'm pretty sure WPF MediaElement won't play HTTPS (secure http) links. Youtube changed to https in early 2016 timeframe (I think).