public virtual void ActionCallback(MediaSessionEventData eventData)
        {
            Console.WriteLine("MS_" + eventData.ActionType);
            if (string.Equals(eventData.ActionType, "Play", StringComparison.InvariantCultureIgnoreCase))
            {
                Play?.Invoke(this, eventData);
            }
            else if (string.Equals(eventData.ActionType, "Pause", StringComparison.InvariantCultureIgnoreCase))
            {
                Pause?.Invoke(this, eventData);
            }
            else if (string.Equals(eventData.ActionType, "Stop", StringComparison.InvariantCultureIgnoreCase))
            {
                Stop?.Invoke(this, eventData);
            }
            else if (string.Equals(eventData.ActionType, "SeekBackward", StringComparison.InvariantCultureIgnoreCase))
            {
                SeekBackward?.Invoke(this, eventData);
            }
            else if (string.Equals(eventData.ActionType, "SeekForward", StringComparison.InvariantCultureIgnoreCase))
            {
                SeekForward?.Invoke(this, eventData);
            }
            else if (string.Equals(eventData.ActionType, "SeekTo", StringComparison.InvariantCultureIgnoreCase))
            {
                SeekTo?.Invoke(this, eventData);
            }
            else if (string.Equals(eventData.ActionType, "PreviousTrack", StringComparison.InvariantCultureIgnoreCase))
            {
                PreviousTrack?.Invoke(this, eventData);
            }
            else if (string.Equals(eventData.ActionType, "NextTrack", StringComparison.InvariantCultureIgnoreCase))
            {
                NextTrack?.Invoke(this, eventData);
            }
            else if (string.Equals(eventData.ActionType, "SkipAd", StringComparison.InvariantCultureIgnoreCase))
            {
                SkipAd?.Invoke(this, eventData);
            }
            else
            {
                throw new ArgumentOutOfRangeException();
            }

            AnyEvent?.Invoke(this, eventData);
        }
Exemplo n.º 2
0
        public void PressPreviousButton()
        {
            Command cmd = new PreviousTrack(player);

            cmd.execute();
        }