/// <summary>
        /// Play or resume (True if playback started (and was already started), or False on error.
        /// </summary>
        /// <returns></returns>
        public bool Play()
        {
            if (!_isStarted)
            {
                if (_eventManager != null)
                {
                    _eventManager.StartListener();
                }
            }

            if (_updateVideoTextureEnum == null)
            {
                _updateVideoTextureEnum = UpdateVideoTexture();
                _monoObject.StartCoroutine(_updateVideoTextureEnum);
            }

            _isStarted = _wrapper.PlayerPlay();

            if (_isStarted)
            {
                if (_isReady && !_isPlaying)
                {
                    _eventManager.SetEvent(PlayerState.Playing);
                }
            }
            else
            {
                Stop();
            }

            return(_isStarted);
        }
示例#2
0
        /// <summary>
        /// Play or resume (True if playback started (and was already started), or False on error.
        /// </summary>
        /// <returns></returns>
        public bool Play()
        {
            if (_playerObj != IntPtr.Zero)
            {
                if (!_isStarted)
                {
                    if (_eventManager != null)
                    {
                        _eventManager.StartListener();
                    }

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

                    if (_options.FixedVideoSize != Vector2.zero)
                    {
                        InitBufferSize((int)_options.FixedVideoSize.x, (int)_options.FixedVideoSize.y);
                    }

                    _wrapper.NativeUpdateFramesCounter(0);
                }

                if (_updateVideoTextureEnum == null)
                {
                    _updateVideoTextureEnum = UpdateVideoTexture();
                    _monoObject.StartCoroutine(_updateVideoTextureEnum);
                }

                _isStarted = _wrapper.PlayerPlay(_playerObj);

                if (_isStarted)
                {
                    if (_audioManager != null)
                    {
                        _audioManager.Play();
                    }

                    if (_isReady && !_isPlaying)
                    {
                        _eventManager.SetEvent(PlayerState.Playing);
                    }
                }
                else
                {
                    Stop();
                }
            }

            return(_isStarted);
        }