private IEnumerator UpdateVideoTexture()
        {
            while (true)
            {
                if (FramesCounter != _framesCounter)
                {
                    _framesCounter = FramesCounter;
                    UpdateFpsCounter();

                    _shareTexture = _wrapper.NativeGetTexture();

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

                        if (_options.FixedVideoSize == Vector2.zero)
                        {
                            int width  = VideoWidth;
                            int height = VideoHeight;

                            if (_videoBuffer == null ||
                                (_videoBuffer != null &&
                                 _videoBuffer.Width != width || _videoBuffer.Height != height))
                            {
                                if (_videoBuffer != null)
                                {
                                    _videoBuffer.ClearFramePixels();
                                }

                                _videoBuffer = new PlayerBufferVideo(width, height);
                                _wrapper.NativeSetPixelsBuffer(_videoBuffer.FramePixelsAddr, _videoBuffer.Width, _videoBuffer.Height);
                            }
                        }

                        _videoTexture = Texture2D.CreateExternalTexture(_videoBuffer.Width, _videoBuffer.Height, TextureFormat.BGRA32, false, false, _shareTexture);
                        MediaPlayerHelper.ApplyTextureToRenderingObjects(_videoTexture, _videoOutputObjects);
                        //_wrapper.NativeHelperSetTexture(_pluginObj, _videoTexture.GetNativeTexturePtr());

                        _isTextureExist = true;
                    }

                    _videoTexture.UpdateExternalTexture(_shareTexture);
                }

                if (_wrapper.PlayerIsReady() && !_isReady)
                {
                    _isReady = true;

                    if (_isLoad)
                    {
                        _eventManager.ReplaceEvent(PlayerState.Paused, PlayerState.Prepared, _videoTexture);
                        Pause();
                    }
                    else
                    {
                        _eventManager.SetEvent(PlayerState.Prepared, _videoTexture);
                        _eventManager.SetEvent(PlayerState.Playing);
                    }
                }

                yield return(null);
            }
        }
        private IEnumerator UpdateVideoTexture()
        {
            while (true)
            {
                if (FramesCounter > 0)
                {
                    UpdateFpsCounter();

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

                        if (_options.FixedVideoSize == Vector2.zero)
                        {
                            int width  = VideoWidth;
                            int height = VideoHeight;

                            if (_videoBuffer == null ||
                                (_videoBuffer != null &&
                                 _videoBuffer.Width != width || _videoBuffer.Height != height))
                            {
                                if (_videoBuffer != null)
                                {
                                    _videoBuffer.ClearFramePixels();
                                }

                                _videoBuffer = new PlayerBufferVideo(width, height);
                            }
                        }

                        _videoTexture = MediaPlayerHelper.GenPluginTexture(_videoBuffer.Width, _videoBuffer.Height);
                        MediaPlayerHelper.ApplyTextureToRenderingObjects(_videoTexture, _videoOutputObjects);
                        _isTextureExist = true;
                        _isImageReady   = false;
                    }

                    _wrapper.NativeUpdateTexture(_videoTexture.GetNativeTexturePtr());

                    if (!_isImageReady)
                    {
                        _eventManager.SetEvent(PlayerState.ImageReady, _videoTexture);
                        _isImageReady = true;
                    }
                }

                if (_wrapper.PlayerIsReady() && !_isReady)
                {
                    _isReady = true;

                    if (_isLoad)
                    {
                        _eventManager.ReplaceEvent(PlayerState.Paused, PlayerState.Prepared, new Vector2(VideoWidth, VideoHeight));
                        Pause();
                    }
                    else
                    {
                        _eventManager.SetEvent(PlayerState.Prepared, new Vector2(VideoWidth, VideoHeight));
                        _eventManager.SetEvent(PlayerState.Playing);
                    }
                }

                yield return(null);
            }
        }