MyToolkit icon indicating copy to clipboard operation
MyToolkit copied to clipboard

YouTube: Youtube not playing in UWP

Open darksody opened this issue 9 years ago • 5 comments

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.

darksody avatar Jun 24 '16 11:06 darksody

Also, takes way longer now for GetVideoUriAsync() to execute. Like 10 seconds+.... Used to be almost instant.

darksody avatar Jun 24 '16 11:06 darksody

Maybe they changed the "API" again...

RicoSuter avatar Jun 24 '16 16:06 RicoSuter

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

darksody avatar Jun 24 '16 21:06 darksody

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 avatar Jun 24 '16 21:06 darksody

@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).

Breakthru001 avatar Aug 13 '16 18:08 Breakthru001