private void OnApplicationQuit()
 {
     if (MLMusicService.IsStarted)
     {
         MLMusicService.Stop();
     }
 }
Exemple #2
0
 /// <summary>
 /// Stops the MLMusicService API.
 /// </summary>
 private void OnApplicationQuit()
 {
     #if PLATFORM_LUMIN
     if (MLMusicService.IsStarted)
     {
         MLMusicService.Stop();
     }
     #endif
 }
Exemple #3
0
        /// <summary>
        /// Cleanup the MLMusicService and unregister callbacks.
        /// </summary>
        void OnDestroy()
        {
            #if PLATFORM_LUMIN
            if (MLMusicService.IsStarted)
            {
                MLMusicService.StopPlayback();

                MLMusicService.OnPlaybackStateChange -= HandlePlaybackStateChanged;
                MLMusicService.OnShuffleStateChange  -= HandleShuffleStateChanged;
                MLMusicService.OnRepeatStateChange   -= HandleRepeatStateChanged;
                MLMusicService.OnMetadataChange      -= HandleMetadataChanged;
                MLMusicService.OnPositionChange      -= HandlePositionChanged;
                MLMusicService.OnError        -= HandleError;
                MLMusicService.OnStatusChange -= HandleServiceStatusChanged;

                MLMusicService.Stop();
            }
            #endif
        }
        /// <summary>
        /// Cleanup the MLMusicService and unregister from the callbacks
        /// </summary>
        void OnDestroy()
        {
            if (MLMusicService.IsStarted)
            {
                MLMusicService.StopPlayback();

                _playbackBar.OnValueChanged           -= Seek;
                _volumeBar.OnValueChanged             -= SetVolume;
                _playButton.OnToggle                  -= PlayPause;
                _prevButton.OnControllerTriggerDown   -= Previous;
                _nextButton.OnControllerTriggerDown   -= Next;
                _shuffleButton.OnToggle               -= ToggleShuffle;
                _repeatButton.OnControllerTriggerDown -= ChangeRepeatState;
                MLMusicService.OnPlaybackStateChange  -= HandlePlaybackStateChanged;
                MLMusicService.OnShuffleStateChange   -= HandleShuffleStateChanged;
                MLMusicService.OnRepeatStateChange    -= HandleRepeatStateChanged;
                MLMusicService.OnMetadataChange       -= HandleMetadataChanged;
                MLMusicService.OnPositionChange       -= HandlePositionChanged;
                MLMusicService.OnError                -= HandleError;
                MLMusicService.OnStatusChange         -= HandleServiceStatusChanged;

                MLMusicService.Stop();
            }
        }