/// <summary> /// If the video is already playing on texture, enabling it will bring the video to full-screen /// otherwise, the video will play on fullscreen the next time user taps on the texture. /// </summary> /// <param name="tf"></param> private void OnTappedOnFullscreenButton(bool tf) { mFullScreenMode = tf; if (tf) { VideoPlaybackBehaviour video = PickVideo(); if (video != null) { if (video.VideoPlayer.IsPlayableFullscreen()) { //On Android, we use Unity's built in player, so Unity application pauses before going to fullscreen. //So we have to handle the orientation from within Unity. #if UNITY_ANDROID Screen.orientation = ScreenOrientation.LandscapeLeft; #endif // Pause the video if it is currently playing video.VideoPlayer.Pause(); // Seek the video to the beginning(); video.VideoPlayer.SeekTo(0.0f); // Display the busy icon video.ShowBusyIcon(); // Play the video full screen video.VideoPlayer.Play(true, 0.0f); //Flash turns off automatically on fullscreen videoplayback mode, so we need to update the UI accordingly this.View.mCameraFlashSettings.Enable(false); } } } OnTappedToClose(); }
/// <summary> /// If the video is already playing on texture, enabling it will bring the video to full-screen /// otherwise, the video will play on fullscreen the next time user taps on the texture. /// </summary> /// <param name="tf"></param> public void ToggleFullscreenMode() { Toggle fullscreenToggle = base.FindUISelectableWithText <Toggle>("Fullscreen"); mPlayVideo.playFullscreen = fullscreenToggle ? fullscreenToggle.isOn : false; if (mPlayVideo.playFullscreen) { VideoPlaybackBehaviour video = PickVideo(); if (video != null) { if (video.VideoPlayer.IsPlayableFullscreen()) { //On Android, we use Unity's built in player, so Unity application pauses before going to fullscreen. //So we have to handle the orientation from within Unity. #if UNITY_ANDROID Screen.orientation = ScreenOrientation.LandscapeLeft; #endif // Pause the video if it is currently playing video.VideoPlayer.Pause(); // Seek the video to the beginning(); video.VideoPlayer.SeekTo(0.0f); // Display the busy icon video.ShowBusyIcon(); // Play the video full screen StartCoroutine(PlayVideo.PlayFullscreenVideoAtEndOfFrame(video)); } } } CloseMenu(); }
/// <summary> /// Handle double tap event /// </summary> private void HandleDoubleTap() { // Find out which video was tapped, if any VideoPlaybackBehaviour video = PickVideo(Input.mousePosition); if (video != null) { AppManager.mActiveViewType = AppManager.ViewType.ARCAMERAVIEW; if (video.VideoPlayer.IsPlayableFullscreen()) { // Pause the video if it is currently playing video.VideoPlayer.Pause(); // Seek the video to the beginning(); video.VideoPlayer.SeekTo(0.0f); // Display the busy icon video.ShowBusyIcon(); // Play the video full screen video.VideoPlayer.Play(true, 0); UpdateFlashSettingsInUIView(); } } }
/// <summary> /// If the video is already playing on texture, enabling it will bring the video to full-screen /// otherwise, the video will play on fullscreen the next time user taps on the texture. /// </summary> /// <param name="tf"></param> private void OnTappedOnFullscreenButton(bool tf) { mFullScreenMode = tf; if (tf) { VideoPlaybackBehaviour video = PickVideo(); if (video != null) { if (video.VideoPlayer.IsPlayableFullscreen()) { //On Android, we use Unity's built in player, so Unity application pauses before going to fullscreen. //So we have to handle the orientation from within Unity. #if UNITY_ANDROID Screen.orientation = ScreenOrientation.LandscapeLeft; #endif // Pause the video if it is currently playing video.VideoPlayer.Pause(); // Seek the video to the beginning(); video.VideoPlayer.SeekTo(0.0f); // Display the busy icon video.ShowBusyIcon(); // Play the video full screen StartCoroutine(PlayVideo.PlayFullscreenVideoAtEndOfFrame(video)); } } } OnTappedToClose(); }
/// <summary> /// Handle single tap event /// </summary> private void HandleTap() { if (QCARRuntimeUtilities.IsPlayMode()) { if (PickVideo(Input.mousePosition) != null) { Debug.LogWarning("Playing videos is currently not supported in Play Mode."); } } // Find out which video was tapped, if any VideoPlaybackBehaviour video = PickVideo(Input.mousePosition); if (video != null) { if (video.VideoPlayer.IsPlayableOnTexture()) { // This video is playable on a texture, toggle playing/paused VideoPlayerHelper.MediaState state = video.VideoPlayer.GetStatus(); if (state == VideoPlayerHelper.MediaState.PAUSED || state == VideoPlayerHelper.MediaState.READY || state == VideoPlayerHelper.MediaState.STOPPED) { // Pause other videos before playing this one PauseOtherVideos(video); // Play this video on texture where it left off video.VideoPlayer.Play(false, video.VideoPlayer.GetCurrentPosition()); } else if (state == VideoPlayerHelper.MediaState.REACHED_END) { // Pause other videos before playing this one PauseOtherVideos(video); // Play this video from the beginning video.VideoPlayer.Play(false, 0); } else if (state == VideoPlayerHelper.MediaState.PLAYING) { // Video is already playing, pause it video.VideoPlayer.Pause(); } } else { // Display the busy icon video.ShowBusyIcon(); // This video cannot be played on a texture, play it full screen video.VideoPlayer.Play(true, 0); } } }
/// <summary> /// Handle single tap event /// </summary> private void HandleTap() { // Find out which video was tapped, if any VideoPlaybackBehaviour video = PickVideo(mTouchStartPos); details = "entering handleTap"; if (video != null) { if (video.VideoPlayer.IsPlayableOnTexture()) { details = "enter playable"; // This video is playable on a texture, toggle playing/paused VideoPlayerHelper.MediaState state = video.VideoPlayer.GetStatus(); if (state == VideoPlayerHelper.MediaState.PAUSED || state == VideoPlayerHelper.MediaState.READY || state == VideoPlayerHelper.MediaState.STOPPED) { // Pause other videos before playing this one PauseOtherVideos(video); // Play this video on texture where it left off video.VideoPlayer.Play(false, video.VideoPlayer.GetCurrentPosition()); } else if (state == VideoPlayerHelper.MediaState.REACHED_END) { // Pause other videos before playing this one PauseOtherVideos(video); // Play this video from the beginning video.VideoPlayer.Play(false, 0); } else if (state == VideoPlayerHelper.MediaState.PLAYING) { // Video is already playing, pause it //video.VideoPlayer.Pause(); } } else { // Display the busy icon video.ShowBusyIcon(); // This video cannot be played on a texture, play it full screen video.VideoPlayer.Play(true, 0); mWentToFullScreen = false; } } }
/// <summary> /// Handle single tap event /// </summary> private void HandleTap() { if (mActiveViewType == AppManager.ViewType.ARCAMERAVIEW) { // Find out which video was tapped, if any VideoPlaybackBehaviour video = PickVideo(Input.mousePosition); if (video != null) { if (video.VideoPlayer.IsPlayableOnTexture()) { // This video is playable on a texture, toggle playing/paused VideoPlayerHelper.MediaState state = video.VideoPlayer.GetStatus(); if (state == VideoPlayerHelper.MediaState.PAUSED || state == VideoPlayerHelper.MediaState.READY || state == VideoPlayerHelper.MediaState.STOPPED) { // Pause other videos before playing this one PauseOtherVideos(video); // Play this video on texture where it left off video.VideoPlayer.Play(false, video.VideoPlayer.GetCurrentPosition()); } else if (state == VideoPlayerHelper.MediaState.REACHED_END) { // Pause other videos before playing this one PauseOtherVideos(video); // Play this video from the beginning video.VideoPlayer.Play(false, 0); } else if (state == VideoPlayerHelper.MediaState.PLAYING) { // Video is already playing, pause it video.VideoPlayer.Pause(); } } else { // Display the busy icon video.ShowBusyIcon(); // This video cannot be played on a texture, play it full screen video.VideoPlayer.Play(true, 0); } } } }
private void PlayVideoFullscreen() { Renderer[] rendererComponents = GetComponentsInChildren <Renderer>(); Collider[] colliderComponents = GetComponentsInChildren <Collider>(); // Enable rendering: foreach (Renderer component in rendererComponents) { component.enabled = true; } // Enable colliders: foreach (Collider component in colliderComponents) { component.enabled = true; } VideoPlaybackBehaviour video = GetComponentInChildren <VideoPlaybackBehaviour>(); Debug.Log("video.AutoPlay " + video.AutoPlay); if (video != null && video.AutoPlay) { //if (video.VideoPlayer.IsPlayableFullscreen()) { //On Android, we use Unity's built in player, so Unity application pauses before going to fullscreen. //So we have to handle the orientation from within Unity. #if UNITY_ANDROID Screen.orientation = ScreenOrientation.LandscapeLeft; #endif // Pause the video if it is currently playing video.VideoPlayer.Pause(); // Seek the video to the beginning(); video.VideoPlayer.SeekTo(0.0f); // Display the busy icon video.ShowBusyIcon(); // Play the video full screen StartCoroutine(PlayFullscreenVideoAtEndOfFrame(video)); } } }
private void HandleDoubleTap() { VideoPlaybackBehaviour video = PickVideo(mTouchStartPos); if (video != null) { if (video.VideoPlayer.IsPlayableFullscreen()) { video.VideoPlayer.Pause(); video.VideoPlayer.SeekTo(0.0f); video.ShowBusyIcon(); video.VideoPlayer.Play(true, 0); mWentToFullScreen = true; } } }
public void PlayFullScreen() { for (int i = 0; i < Targets.Length; i++) { if (CurrentImageTarget == i + 1) { VideoPlaybackBehaviour video = Targets [i].GetComponentInChildren <VideoPlaybackBehaviour>(); if (video != null && video.VideoPlayer != null) { // VideoPlayerHelper.MediaState state = video.VideoPlayer.GetStatus(); // if (state == VideoPlayerHelper.MediaState.PAUSED || // state == VideoPlayerHelper.MediaState.READY || // state == VideoPlayerHelper.MediaState.STOPPED) // { // // Pause other videos before playing this one // PauseOtherVideos(video); // video.VideoPlayer.Pause(); // // Play this video on texture where it left off // video.VideoPlayer.Play(true, video.VideoPlayer.GetCurrentPosition()); // } // else if (state == VideoPlayerHelper.MediaState.REACHED_END) // { // // Pause other videos before playing this one // PauseOtherVideos(video); // video.VideoPlayer.Pause(); // // Play this video from the beginning // video.VideoPlayer.Play(true, 0); // } // Pause the video if it is currently playing video.VideoPlayer.Pause(); // Seek the video to the beginning(); video.VideoPlayer.SeekTo(0.0f); // Display the busy icon video.ShowBusyIcon(); StartCoroutine(PlayFullscreenVideoAtEndOfFrame(video)); // Play the video full screen } } } }
private void HandleTap() { VideoPlaybackBehaviour video = PickVideo(mTouchStartPos); if (video != null) { if (video.VideoPlayer.IsPlayableOnTexture()) { VideoPlayerHelper.MediaState state = video.VideoPlayer.GetStatus(); if (state == VideoPlayerHelper.MediaState.PAUSED || state == VideoPlayerHelper.MediaState.READY || state == VideoPlayerHelper.MediaState.STOPPED) { PauseOtherVideos(video); video.VideoPlayer.Play(false, video.VideoPlayer.GetCurrentPosition()); } else if (state == VideoPlayerHelper.MediaState.REACHED_END) { PauseOtherVideos(video); video.VideoPlayer.Play(false, 0); } else if (state == VideoPlayerHelper.MediaState.PLAYING) { video.VideoPlayer.Pause(); } } else { video.ShowBusyIcon(); video.VideoPlayer.Play(true, 0); mWentToFullScreen = true; } } }
// Handle double tap event private void HandleDoubleTap() { // Find out which video was tapped, if any VideoPlaybackBehaviour video = PickVideo(mTouchStartPos); if (video != null) { if (video.VideoPlayer.IsPlayableFullscreen()) { // Pause the video if it is currently playing video.VideoPlayer.Pause(); // Seek the video to the beginning(); video.VideoPlayer.SeekTo(0.0f); // Display the busy icon video.ShowBusyIcon(); // Play the video full screen video.VideoPlayer.Play(true, 0); mWentToFullScreen = true; } } }
/// <summary> /// Handle single tap event /// </summary> private void HandleSingleTap() { if (QCARRuntimeUtilities.IsPlayMode()) { if (PickVideo(Input.mousePosition) != null) Debug.LogWarning("Playing videos is currently not supported in Play Mode."); } // Find out which video was tapped, if any currentVideo = PickVideo(Input.mousePosition); if (currentVideo != null) { if (IsFullScreenModeEnabled()) { if (currentVideo.VideoPlayer.IsPlayableFullscreen()) { //On Android, we use Unity's built in player, so Unity application pauses before going to fullscreen. //So we have to handle the orientation from within Unity. #if UNITY_ANDROID Screen.orientation = ScreenOrientation.LandscapeLeft; #endif // Pause the video if it is currently playing currentVideo.VideoPlayer.Pause(); // Seek the video to the beginning(); currentVideo.VideoPlayer.SeekTo(0.0f); // Display the busy icon currentVideo.ShowBusyIcon(); // Play the video full screen StartCoroutine( PlayFullscreenVideoAtEndOfFrame(currentVideo) ); UpdateFlashSettingsInUIView(); } } else { if (currentVideo.VideoPlayer.IsPlayableOnTexture()) { // This video is playable on a texture, toggle playing/paused VideoPlayerHelper.MediaState state = currentVideo.VideoPlayer.GetStatus(); if (state == VideoPlayerHelper.MediaState.PAUSED || state == VideoPlayerHelper.MediaState.READY || state == VideoPlayerHelper.MediaState.STOPPED) { // Pause other videos before playing this one PauseOtherVideos(currentVideo); // Play this video on texture where it left off currentVideo.VideoPlayer.Play(false, currentVideo.VideoPlayer.GetCurrentPosition()); } else if (state == VideoPlayerHelper.MediaState.REACHED_END) { // Pause other videos before playing this one PauseOtherVideos(currentVideo); // Play this video from the beginning currentVideo.VideoPlayer.Play(false, 0); } else if (state == VideoPlayerHelper.MediaState.PLAYING) { // Video is already playing, pause it currentVideo.VideoPlayer.Pause(); } } else { // Display the busy icon currentVideo.ShowBusyIcon(); // This video cannot be played on a texture, play it full screen StartCoroutine( PlayFullscreenVideoAtEndOfFrame(currentVideo) ); } } } }
/// <summary> /// Handle single tap event /// </summary> private void HandleSingleTap() { if (QCARRuntimeUtilities.IsPlayMode()) { if (PickVideo(Input.mousePosition) != null) { Debug.LogWarning("Playing videos is currently not supported in Play Mode."); } } // Find out which video was tapped, if any currentVideo = PickVideo(Input.mousePosition); if (currentVideo != null) { if (IsFullScreenModeEnabled()) { if (currentVideo.VideoPlayer.IsPlayableFullscreen()) { //On Android, we use Unity's built in player, so Unity application pauses before going to fullscreen. //So we have to handle the orientation from within Unity. #if UNITY_ANDROID Screen.orientation = ScreenOrientation.LandscapeLeft; #endif // Pause the video if it is currently playing currentVideo.VideoPlayer.Pause(); // Seek the video to the beginning(); currentVideo.VideoPlayer.SeekTo(0.0f); // Display the busy icon currentVideo.ShowBusyIcon(); // Play the video full screen StartCoroutine(PlayFullscreenVideoAtEndOfFrame(currentVideo)); UpdateFlashSettingsInUIView(); } } else { if (currentVideo.VideoPlayer.IsPlayableOnTexture()) { // This video is playable on a texture, toggle playing/paused VideoPlayerHelper.MediaState state = currentVideo.VideoPlayer.GetStatus(); if (state == VideoPlayerHelper.MediaState.PAUSED || state == VideoPlayerHelper.MediaState.READY || state == VideoPlayerHelper.MediaState.STOPPED) { // Pause other videos before playing this one PauseOtherVideos(currentVideo); // Play this video on texture where it left off currentVideo.VideoPlayer.Play(false, currentVideo.VideoPlayer.GetCurrentPosition()); } else if (state == VideoPlayerHelper.MediaState.REACHED_END) { // Pause other videos before playing this one PauseOtherVideos(currentVideo); // Play this video from the beginning currentVideo.VideoPlayer.Play(false, 0); } else if (state == VideoPlayerHelper.MediaState.PLAYING) { // Video is already playing, pause it currentVideo.VideoPlayer.Pause(); } } else { // Display the busy icon currentVideo.ShowBusyIcon(); // This video cannot be played on a texture, play it full screen StartCoroutine(PlayFullscreenVideoAtEndOfFrame(currentVideo)); } } } }
/// <summary> /// Try to pick video at tap screen position /// </summary> public void TryPickingVideo() { if (VuforiaRuntimeUtilities.IsPlayMode()) { if (PickVideo(Input.mousePosition) != null) { Debug.LogWarning("Playing videos is currently not supported in Play Mode."); } } // Find out which video was tapped, if any currentVideo = PickVideo(Input.mousePosition); if (currentVideo != null) { if (playFullscreen) { if (currentVideo.VideoPlayer.IsPlayableFullscreen()) { // Pause the video if it is currently playing currentVideo.VideoPlayer.Pause(); // Seek the video to the beginning(); currentVideo.VideoPlayer.SeekTo(0.0f); // Display the busy icon currentVideo.ShowBusyIcon(); // Play the video full screen StartCoroutine(PlayFullscreenVideoAtEndOfFrame(currentVideo)); } } else { if (currentVideo.VideoPlayer.IsPlayableOnTexture()) { // This video is playable on a texture, toggle playing/paused VideoPlayerHelper.MediaState state = currentVideo.VideoPlayer.GetStatus(); if (state == VideoPlayerHelper.MediaState.PAUSED || state == VideoPlayerHelper.MediaState.READY || state == VideoPlayerHelper.MediaState.STOPPED) { // Pause other videos before playing this one PauseOtherVideos(currentVideo); // Play this video on texture where it left off currentVideo.VideoPlayer.Play(false, currentVideo.VideoPlayer.GetCurrentPosition()); } else if (state == VideoPlayerHelper.MediaState.REACHED_END) { // Pause other videos before playing this one PauseOtherVideos(currentVideo); // Play this video from the beginning currentVideo.VideoPlayer.Play(false, 0); } else if (state == VideoPlayerHelper.MediaState.PLAYING) { // Video is already playing, pause it currentVideo.VideoPlayer.Pause(); } } else { // Display the busy icon currentVideo.ShowBusyIcon(); // This video cannot be played on a texture, play it full screen StartCoroutine(PlayFullscreenVideoAtEndOfFrame(currentVideo)); } } } }