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; } } }
public static async Task pause() { await mediaChannel.PauseAsync(); }
public Task <MediaStatus> PauseAsync() { IsPlaying = false; return(_mediaChannel.PauseAsync(_sender)); }