Beispiel #1
0
        private async void BackgroundMediaPlayer_MediaOpened(MediaPlayer sender, object args)
        {
            FolderMusicUwpLib.SaveTextClass.SaveText("Open", CurrentSong.Title);

            openSong        = CurrentSong;
            sender.Position = TimeSpan.FromMilliseconds(CurrentSongPositionTotalMilliseconds);

            if (autoPlay)
            {
                if (sender.Position.TotalMilliseconds == 1)
                {
                    sender.Volume = 1;
                    sender.Play();
                }
                else
                {
                    Play();
                }
            }
            else
            {
                systemMediaTransportControl.PlaybackStatus = MediaPlaybackStatus.Paused;
            }

            playNext = true;

            if (CurrentSong.NaturalDurationMilliseconds == 1)
            {
                CurrentSong.NaturalDurationMilliseconds = sender.NaturalDuration.TotalMilliseconds;
            }

            UpdateSystemMediaTransportControl();

            /*
             * if (!Library.IsLoaded) await LoadLibraryData();
             * else                //      */
            {
                ForegroundCommunicator.SendSongsIndexAndShuffleIfComplete();
            }

            await LibraryLib.CurrentSong.Current.Save();
        }