public void ReceiveNotification(string sourceFileUrl, NotificationType type)
        {
            if (mediaChannel != null)
            {
                switch (type)
                {
                case NotificationType.PlayStateChanged:

                    //Play and pause the chromecast from the MB player
                    if (mediaChannel.Status != null)
                    {
                        switch (mbApiInterface.Player_GetPlayState())
                        {
                        case PlayState.Paused:
                            mediaChannel.PauseAsync().WaitWithoutException();
                            break;

                        case PlayState.Playing:
                            mediaChannel.PlayAsync().WaitWithoutException();
                            break;
                        }
                    }

                    break;

                case NotificationType.NowPlayingListChanged:
                    //natural = false;
                    //progressTimer.Enabled = false;
                    break;

                case NotificationType.PluginStartup:
                    break;

                case NotificationType.VolumeLevelChanged:
                    break;

                case NotificationType.TrackChanged:

                    if (!PrerequisitesMet())
                    {
                        return;
                    }

                    fileDeletionTimer.Enabled = false;
                    fileDeletionTimer.Enabled = true;

                    CalculateHash(mbApiInterface.NowPlaying_GetFileUrl(), "current").WaitWithoutException();

                    var info = CopySong(sourceFileUrl, songHash.Current).WaitAndUnwrapException();
                    _ = LoadSong(info.Item1, info.Item2);

                    break;
                }
            }
        }
Exemple #2
0
 public static async Task pause()
 {
     await mediaChannel.PauseAsync();
 }
Exemple #3
0
 public Task <MediaStatus> PauseAsync()
 {
     IsPlaying = false;
     return(_mediaChannel.PauseAsync(_sender));
 }