RicoSuter / MyToolkit

MyToolkit for .NET
http://mytoolkit.io
Microsoft Public License
339 stars 76 forks source link

UWP Can't play some YouTube link on mediaelement #89

Open droprose opened 7 years ago

droprose commented 7 years ago

I have a mediaelement to play youtube with XAML and code below: XAML:

<MediaElement AutoPlay="False" AreTransportControlsEnabled="True" IsFullWindow="False">
    <MediaElement.TransportControls>
        <MediaTransportControls IsFullWindowButtonVisible="True"/>
    </MediaElement.TransportControls>
</MediaElement>

Code:

videoLink.Text = "https://www.youtube.com/watch?v=QJ9h7EBs5LU";
string videoLink = VideoLink.Text.Substring(Math.Max(0, VideoLink.Text.Length - 11));

var url = await YouTube.GetVideoUriAsync(videoLink.ToString(), YouTubeQuality.Quality480P);
YoutubePlayer.Source = url.Uri;
YoutubePlayer.Play();

I'm having trouble, ie can not play youtube with error message : Unsopported video type or invalid file path How to handle it?

teja8352 commented 4 years ago

Hello droprose,

Have you find any solution. I am getting this exception while using var url = await YouTube.GetVideoUriAsync(youTubeId, YouTubeQuality.Quality720P);

MyToolkit.Multimedia.YouTubeUriNotFoundException: No matching YouTube video or audio stream URI could be found. The video may not be available in your country, is private or uses RTMPE (protected streaming).