Ejemplo n.º 1
0
        public void Stop(bool resetTexture)
        {
            _wrapper.PlayerStop();

            if (_updateVideoTextureEnum != null)
            {
                _monoObject.StopCoroutine(_updateVideoTextureEnum);
                _updateVideoTextureEnum = null;
            }

            _framesCounter    = 0;
            _frameRate        = 0;
            _tmpFramesCounter = 0;
            _tmpTime          = 0;

            _isStarted      = false;
            _isPlaying      = false;
            _isLoad         = false;
            _isReady        = false;
            _isTextureExist = !resetTexture;

            if (resetTexture)
            {
                if (_videoTexture != null)
                {
                    UnityEngine.Object.Destroy(_videoTexture);
                    _videoTexture = null;
                }
            }

            if (_eventManager != null)
            {
                _eventManager.StopListener();
            }
        }
        /// <summary>
        /// Stop current video playback
        /// </summary>
        /// <param name="resetTexture">Clear previous playback texture</param>
        public void Stop(bool resetTexture)
        {
            if (_playerObj != IntPtr.Zero && _isStarted)
            {
                _wrapper.PlayerStop(_playerObj);

                if (_updateVideoTextureEnum != null)
                {
                    _monoObject.StopCoroutine(_updateVideoTextureEnum);
                    _updateVideoTextureEnum = null;
                }

                _framesCounter    = 0;
                _frameRate        = 0;
                _tmpFramesCounter = 0;
                _tmpTime          = 0;

                _isStarted = false;
                _isPlaying = false;
                _isLoad    = false;
                _isReady   = false;

                _wrapper.NativeUpdateFramesCounter(0);
                _wrapper.NativeClearAudioSamples(0);
                _wrapper.NativePixelsBufferRelease();

                _isTextureExist = !resetTexture;

                if (resetTexture)
                {
                    if (_videoTexture != null)
                    {
                        UnityEngine.Object.Destroy(_videoTexture);
                        _videoTexture = null;
                    }
                }

                if (_videoBuffer != null &&
                    _options.FixedVideoSize == Vector2.zero)
                {
                    _videoBuffer.ClearFramePixels();
                    _videoBuffer = null;
                }

                if (_audioDataHandle.IsAllocated)
                {
                    _audioDataHandle.Free();
                }

                if (_audioManager != null)
                {
                    _audioManager.Stop();
                }

                if (_eventManager != null)
                {
                    _eventManager.StopListener();
                }

                if (_logManager != null)
                {
                    _logManager.StopListener();
                }
            }
        }