private void Awake() { //Keeps the Menu music playing through all of the menu scenes if (instance != null && instance != this) { Destroy(gameObject); return; } else { instance = this; } DontDestroyOnLoad(gameObject); }
protected virtual void OnMediaPlaybackChanged(MediaPlaybackStateChangedEventArgs e) { ThreadPool.QueueUserWorkItem(m => { switch (e.PlaybackState) { case PlaybackStateCode.Playing: MusicPlaying?.Invoke(this, EventArgs.Empty); break; case PlaybackStateCode.Paused: MusicPaused?.Invoke(this, EventArgs.Empty); break; } MediaPlaybackChanged?.Invoke(this, e); }); }
public void OnPlaybackStateChanged(RemoteControlPlayState state) { PlaybackState = state; MusicStatus = state; Log.Info("LiveDisplay", "Music state is" + state); OnMediaPlaybackChanged(new MediaPlaybackStateChangedKitkatEventArgs { PlaybackState = state }); switch (state) { case RemoteControlPlayState.Playing: MusicPlaying?.Invoke(null, EventArgs.Empty); break; case RemoteControlPlayState.Paused: MusicPaused?.Invoke(null, EventArgs.Empty); break; } }