// </SnippetSystemMediaTransportControlsButtonPressed>
        // <SnippetSystemMediaTransportControlsUpdater>
        async void MediaElement_MediaOpened(object sender, RoutedEventArgs e)
        {
            // Get the updater.
            SystemMediaTransportControlsDisplayUpdater updater = _systemMediaTransportControls.DisplayUpdater;

            await updater.CopyFromFileAsync(MediaPlaybackType.Music, currentMediaFile);

            // Update the system media transport controls
            updater.Update();
        }
Exemple #2
0
        async void UpdateUpdater(StorageFile file, SystemMediaTransportControlsDisplayUpdater updater, string[] updaterfileinfo)
        {
            try {
                await updater.CopyFromFileAsync(MediaPlaybackType.Music, file);

                updater.Update();
                updaterfileinfo[0] = file.DisplayName;
                updaterfileinfo[1] = file.Path;
            }
            catch (Exception e) { Debug.WriteLine(e.Message); requestedGetPlaybackInfo = true; }
        }
Exemple #3
0
        // </SnippetSystemMediaTransportControlsButtonPressed>
        // </SnippetSystemMediaTransportControlsBackgroundAll>

        // <SnippetSystemMediaTransportControlsUpdater>
        async private void UpdateSongInfo()
        {
            // Get the updater.
            SystemMediaTransportControlsDisplayUpdater updater = systemControls.DisplayUpdater;

            // Get the music file and pass it to CopyFromFileAsync to extract the metadata
            // and thumbnail. StorageFile is defined in Windows.Storage
            StorageFile musicFile =
                await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Music/music1.mp3"));

            await updater.CopyFromFileAsync(MediaPlaybackType.Music, musicFile);

            // Update the system media transport controls
            updater.Update();
        }
Exemple #4
0
        public async void RefreshGUI(string Title, string Artist, BitmapImage Cover, bool isMusic, StorageFile file)
        {
            mediaPlayer.Position = TimeSpan.FromSeconds(0);
            if (isMusic)
            {
                TitleHolder.Text       = Title;
                ArtistHolder.Text      = Artist;
                CoverHolder.Source     = Cover;
                BGImage.ImageSource    = Cover;
                mediaPlayer.Visibility = Visibility.Collapsed;

                SystemMediaTransportControlsDisplayUpdater updater = _systemMediaTransportControls.DisplayUpdater;

                await updater.CopyFromFileAsync(MediaPlaybackType.Music, file);

                // Update the system media transport controls
                updater.Update();
            }
            else
            {
                TitleHolder.Text       = "";
                ArtistHolder.Text      = "";
                CoverHolder.Source     = null;
                BGImage.ImageSource    = null;
                mediaPlayer.Visibility = Visibility.Visible;

                SystemMediaTransportControlsDisplayUpdater updater = _systemMediaTransportControls.DisplayUpdater;

                await updater.CopyFromFileAsync(MediaPlaybackType.Video, file);

                updater.VideoProperties.Title = Title;

                // Update the system media transport controls
                updater.Update();
            }
        }