/// <summary>
        ///  Create instance of MediaPlayerAndroid object with additional arguments
        /// </summary>
        /// <param name="monoObject">MonoBehaviour instanse</param>
        /// <param name="videoOutputObjects">Objects that will be rendering video output</param>
        /// <param name="options">Additional player optons</param>
        public MediaPlayerAndroid(MonoBehaviour monoObject, GameObject[] videoOutputObjects, PlayerOptionsAndroid options)
        {
            _monoObject         = monoObject;
            _videoOutputObjects = videoOutputObjects;
            _options            = options;

            _wrapper = new WrapperAndroid(_options);

            if (_wrapper.NativeIndex < 0)
            {
                Debug.LogError("Don't support video playback on current platform or you use incorrect UMP libraries!");
                throw new Exception();
            }

            if (_options != null)
            {
                if (_options.FixedVideoSize != Vector2.zero)
                {
                    _videoBuffer = new PlayerBufferVideo((int)_options.FixedVideoSize.x, (int)_options.FixedVideoSize.y);
                    _wrapper.NativeSetPixelsBuffer(_videoBuffer.FramePixelsAddr, _videoBuffer.Width, _videoBuffer.Height);
                }
            }

            _eventManager = new PlayerManagerEvents(_monoObject, this);
            _eventManager.PlayerPlayingListener += OnPlayerPlaying;
            _eventManager.PlayerPausedListener  += OnPlayerPaused;
        }
Beispiel #2
0
        /// <summary>
        ///  Create instance of MediaPlayerAndroid object with additional arguments
        /// </summary>
        /// <param name="monoObject">MonoBehaviour instanse</param>
        /// <param name="videoOutputObjects">Objects that will be rendering video output</param>
        /// <param name="options">Additional player optons</param>
        public MediaPlayerAndroid(MonoBehaviour monoObject, GameObject[] videoOutputObjects, PlayerOptionsAndroid options)
        {
            _monoObject         = monoObject;
            _videoOutputObjects = videoOutputObjects;
            _options            = options;

            _wrapper = new WrapperAndroid(_options);

            if (_wrapper.NativeIndex < 0)
            {
                Debug.LogError("Don't support video playback on current platform or you use incorrect UMP libraries!");
                throw new Exception();
            }

            _eventManager = new PlayerManagerEvents(_monoObject, this);
            _eventManager.PlayerPlayingListener += OnPlayerPlaying;
            _eventManager.PlayerPausedListener  += OnPlayerPaused;
        }