示例#1
0
        private MediaControlSession CurrentSession()
        {
            MediaControlSession session = sessionManager?.GetCurrentSession();

            if (currentSession != session)
            {
                currentSession = session;
                if (currentSession == null)
                {
                    return(null);
                }

                currentSession.MediaPropertiesChanged += OnMediaChanged;
                currentSession.PlaybackInfoChanged    += OnPlaybackInfoChanged;
                //currentSession.TimelinePropertiesChanged += OnTimelinePropertiesChanged;
            }

            return(currentSession);
        }
示例#2
0
        private void OnPlaybackInfoChanged(MediaControlSession sender, PlaybackInfoChangedEventArgs args)
        {
            GlobalSystemMediaTransportControlsSessionPlaybackInfo playbackInfo = CurrentSession()?.GetPlaybackInfo();

            PlaybackInfoChanged?.Invoke(sender, playbackInfo);
        }
示例#3
0
 private void OnMediaChanged(MediaControlSession sender, MediaPropertiesChangedEventArgs args)
 {
     mediaProperties = sender.TryGetMediaPropertiesAsync().GetAwaiter().GetResult();
     CurrentMediaChanged(sender, MediaInfo.FromMediaProperties(mediaProperties));
 }