/// <summary> /// Create instance of MediaPlayerIPhone 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 options</param> public MediaPlayerIPhone(MonoBehaviour monoObject, GameObject[] videoOutputObjects, PlayerOptionsIPhone options) { _monoObject = monoObject; _videoOutputObjects = videoOutputObjects; _options = options; _wrapper = new WrapperInternal(_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) { _optionsLine = _options.GetOptions('\n'); if (_options.FixedVideoSize != Vector2.zero) { _videoBuffer = new PlayerBufferVideo((int)_options.FixedVideoSize.x, (int)_options.FixedVideoSize.y); _wrapper.NativeSetPixelsBuffer(_videoBuffer.FramePixelsAddr, _videoBuffer.Width, _videoBuffer.Height); } } _wrapper.NativeInitPlayer(_optionsLine); _eventManager = new PlayerManagerEvents(_monoObject, this); _eventManager.PlayerPlayingListener += OnPlayerPlaying; _eventManager.PlayerPausedListener += OnPlayerPaused; }
/// <summary> /// Create instance of MediaPlayerWebGL 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 options</param> public MediaPlayerWebGL(MonoBehaviour monoObject, GameObject[] videoOutputObjects, PlayerOptions options) { _monoObject = monoObject; _videoOutputObjects = videoOutputObjects; _options = options; _wrapper = new WrapperInternal(null); if (_options != null) { if (_options.FixedVideoSize != Vector2.zero) { _videoBuffer = new PlayerBufferVideo((int)_options.FixedVideoSize.x, (int)_options.FixedVideoSize.y); } } _eventManager = new PlayerManagerEvents(_monoObject, this); _eventManager.PlayerPlayingListener += OnPlayerPlaying; _eventManager.PlayerPausedListener += OnPlayerPaused; }