コード例 #1
0
    /// <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();
    }
コード例 #2
0
    /// <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();
    }