Example #1
0
 public static void Dispose()
 {
     if (player != null)
     {
         isPlay = false;
         player.Stop();
         player.Dispose();
         MainActivity.GetAudioManager.AbandonAudioFocus(focus);
     }
 }
Example #2
0
 private void TryDisposePlayer()
 {
     if (_player != null)
     {
         try
         {
             _isPlayRequested  = false;
             _isPlayerPrepared = false;
             _player.Release();
         }
         finally
         {
             _player?.Dispose();
             _player = null;
         }
     }
 }
Example #3
0
        private void TryDisposePlayer()
        {
            if (_player != null)
            {
                try
                {
                    _isPlayRequested  = false;
                    _isPlayerPrepared = false;
                    _player.Release();

                    var surfaceView = RenderSurface as SurfaceView;
                    surfaceView?.Holder?.RemoveCallback(this);
                }
                finally
                {
                    _player?.Dispose();
                    _player = null;
                }
            }
        }
        void DeletePlayer()
        {
            Stop();

            if (player != null)
            {
                player.Completion -= OnPlaybackEnded;
                player.Release();
                player.Dispose();
                player = null;
            }

            if (mNextPlayer != null)
            {
                mNextPlayer.Completion -= OnPlaybackEnded;
                mNextPlayer.Release();
                mNextPlayer.Dispose();
                mNextPlayer = null;
            }

            DeleteFile(path);
            path = string.Empty;
        }
Example #5
0
        private void TryDisposePlayer()
        {
            if (_player != null)
            {
                try
                {
                    _isPlayRequested  = false;
                    _isPlayerPrepared = false;
                    _player.Release();

                    // Clear the surface view so we don't see
                    // the previous video rendering.
                    if (RenderSurface is VideoSurface surfaceView && _hasValidHolder)
                    {
                        surfaceView.Clear();
                    }
                }
                finally
                {
                    _player?.Dispose();
                    _player = null;
                }
            }
        }