/// <summary> /// Create instance of media player 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 MediaPlayer(MonoBehaviour monoObject, GameObject[] videoOutputObjects, PlayerOptions options) { var supportedPlatform = UMPSettings.RuntimePlatform; switch (supportedPlatform) { case UMPSettings.Platforms.Win: case UMPSettings.Platforms.Mac: case UMPSettings.Platforms.Linux: PlayerOptionsStandalone standaloneOptions = null; if (options is PlayerOptionsStandalone) { standaloneOptions = options as PlayerOptionsStandalone; } else { standaloneOptions = new PlayerOptionsStandalone(null); } _playerObject = new MediaPlayerStandalone(monoObject, videoOutputObjects, standaloneOptions); break; case UMPSettings.Platforms.iOS: PlayerOptionsIPhone iphoneOptions = null; if (options is PlayerOptionsIPhone) { iphoneOptions = options as PlayerOptionsIPhone; } else { iphoneOptions = new PlayerOptionsIPhone(null); } _playerObject = new MediaPlayerIPhone(monoObject, videoOutputObjects, iphoneOptions); break; case UMPSettings.Platforms.Android: PlayerOptionsAndroid androidOptions = null; if (options is PlayerOptionsAndroid) { androidOptions = options as PlayerOptionsAndroid; } else { androidOptions = new PlayerOptionsAndroid(null); } _playerObject = new MediaPlayerAndroid(monoObject, videoOutputObjects, androidOptions); break; /* * case UMPSettings.Platforms.WebGL: * _playerObject = new MediaPlayerWebGL(monoObject, videoOutputObjects, options); * break;*/ } if (_playerObject is IPlayer) { _player = (_playerObject as IPlayer); } if (_playerObject is IPlayerAudio) { _playerAudio = (_playerObject as IPlayerAudio); } if (_playerObject is IPlayerSpu) { _playerSpu = (_playerObject as IPlayerSpu); } }
void Start() { audio = AudioManager.Instance; }