Exemple #1
0
        public async void setSourceAsync(string link, MediaPlayer mediaElement)
        {
            YouTube      youTube = YouTube.Default;
            YouTubeVideo video   = null;

            video = await youTube.GetVideoAsync(link);

            Debug.WriteLine("Download Display: " + video.Resolution + ", AudioBit: " + video.AudioBitrate + ", 포맷: " + video.Format);
            var memStream = new MemoryStream();

            await(await video.StreamAsync()).CopyToAsync(memStream);
            memStream.Position  = 0;
            mediaElement.Source = MediaSource.CreateFromStream(memStream.AsRandomAccessStream(), video.FileExtension);
            mediaElement.Play();
        }