コード例 #1
0
        private async void Switch()
        {
            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
            t = t == 0 ? 0 : 0;
            var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Assets/{files[t]}"));

            var stream = await file.OpenReadAsync();

            var mediaSource = await MediaSource.CreateFromStream(stream);

            var duration = mediaSource.Duration;

            //Debug.WriteLine($"Title: {mediaSource.Title}");
            //Debug.WriteLine($"Album: {mediaSource.Album}");
            //Debug.WriteLine($"Artist: {mediaSource.Artist}");
            //Debug.WriteLine($"AlbumArtist: {mediaSource.AlbumArtist}");
            //Debug.WriteLine($"Duration: {mediaSource.Duration}");
            //Debug.WriteLine($"Lyrics: {mediaSource.Lyrics}");

            smtc.DisplayUpdater.MusicProperties.Title = "ss";
            smtc.DisplayUpdater.Update();

            mediaPlayer.SetMediaSource(mediaSource);
        }