/// <summary> /// Will show native play activity and open video that avaliable by the <see cref="url"/> param. /// </summary> /// <param name="url">Remove video url.</param> public static void ShowRemoteVideo(string url, Action onClose) { if (Application.isEditor) { Application.OpenURL(url); onClose.Invoke(); return; } switch (Application.platform) { case RuntimePlatform.Android: AN_MediaPlayer.ShowRemoteVideo(url, onClose); break; case RuntimePlatform.IPhonePlayer: var isn_uri = ISN_NSURL.URLWithString(url); var player = new ISN_AVPlayer(isn_uri); var viewController = new ISN_AVPlayerViewController(); viewController.Player = player; viewController.Show(); onClose.Invoke(); break; } }
private void Awake() { AddFitter(m_Image.gameObject); AddFitter(m_Sprite.gameObject); m_ImageCapture.onClick.AddListener(() => { StartPicker(ISN_UIImagePickerControllerSourceType.Camera, ISN_UIMediaType.IMAGE); }); m_ImageLibrary.onClick.AddListener(() => { StartPicker(ISN_UIImagePickerControllerSourceType.PhotoLibrary, ISN_UIMediaType.IMAGE); }); m_ImageAlbum.onClick.AddListener(() => { StartPicker(ISN_UIImagePickerControllerSourceType.Album, ISN_UIMediaType.IMAGE); }); m_VideoCapture.onClick.AddListener(() => { StartPicker(ISN_UIImagePickerControllerSourceType.Camera, ISN_UIMediaType.MOVIE); }); m_VideoLibrary.onClick.AddListener(() => { StartPicker(ISN_UIImagePickerControllerSourceType.PhotoLibrary, ISN_UIMediaType.MOVIE); }); m_VideoAlbum.onClick.AddListener(() => { StartPicker(ISN_UIImagePickerControllerSourceType.Album, ISN_UIMediaType.MOVIE); }); m_VideoPlay.onClick.AddListener(() => { if (!ISN_Settings.Instance.AVKit) { DisplayMessage("AVKit should be enabled in plugin setting in order to play a video"); return; } var url = ISN_NSURL.URLWithString(m_LastPickerResult.MediaURL); var player = new ISN_AVPlayer(url); var viewController = new ISN_AVPlayerViewController { Player = player }; viewController.Show(); }); UpdateUI(); }
private void OnGUI() { if (GUI.Button(new Rect(0, 0, 500, 100), "Playe Video By URL")) { var url = ISN_NSURL.URLWithString("https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"); var player = new ISN_AVPlayer(url); var viewController = new ISN_AVPlayerViewController(); viewController.Player = player; //Optional setting that you can apply player.Volume = 0.8f; viewController.ShowsPlaybackControls = true; viewController.AllowsPictureInPicturePlayback = false; viewController.ShouldCloseWhenFinished = false; viewController.Show(); } if (GUI.Button(new Rect(300, 0, 500, 100), "Playe Video By URL no close")) { var url = ISN_NSURL.URLWithString("https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"); var player = new ISN_AVPlayer(url); var viewController = new ISN_AVPlayerViewController(); viewController.Player = player; //Optional setting that you can apply player.Volume = 0.8f; viewController.Show(); } if (GUI.Button(new Rect(700, 0, 500, 100), "Playe LOCAL")) { var url = ISN_NSURL.StreamingAssetsURLWithPath("big_buck_bunny.mp4"); var player = new ISN_AVPlayer(url); player.Volume = 0; var viewController = new ISN_AVPlayerViewController(); viewController.Player = player; viewController.Show(); } }
private void IOSOnlySetup() { m_IOSPlayButton.onClick.AddListener(() => { var url = ISN_NSURL.URLWithString(k_ExampleVideoUrl); var player = new ISN_AVPlayer(url); var viewController = new ISN_AVPlayerViewController(); viewController.Player = player; //Optional setting that you can apply player.Volume = 0.8f; viewController.ShowsPlaybackControls = m_ShowsPlaybackControls.isOn; viewController.AllowsPictureInPicturePlayback = m_AllowsPictureInPicturePlayback.isOn; viewController.ShouldCloseWhenFinished = m_ShouldCloseWhenFinished.isOn; viewController.Show(); }); }