예제 #1
0
        private void VideoControllerPlayVideo()
        {
            videoControllerReady = true;

            if (videoPlayerType == VideoPlayerType.UnityPlayer)
            {
                controller.PlayVideo(vimeoVideo, selectedResolution);
            }
            else
            {
#if VIMEO_AVPRO_VIDEO_SUPPORT
                string file_url = null;

                if (this.selectedResolution == StreamingResolution.Adaptive)
                {
                    file_url = vimeoVideo.GetAdaptiveVideoFileURL();
                }
                else
                {
                    file_url = vimeoVideo.GetVideoFileUrlByResolution(selectedResolution);
                }

                if (videoPlayerType == VideoPlayerType.AVProVideo && mediaPlayer != null)
                {
                    mediaPlayer.OpenVideoFromFile(RenderHeads.Media.AVProVideo.MediaPlayer.FileLocation.AbsolutePathOrURL, file_url, autoPlay || playVideoAfterLoad);
                }
#if VIMEO_DEPTHKIT_SUPPORT
                // TODO
                else if (videoPlayerType == VideoPlayerType.DepthKit && depthKitClip != null)
                {
                    // depthKitClip._moviePath = file_url;
                    // depthKitClip._metaDataText = vimeoVideo.description;
                    // depthKitClip.GetComponent<RenderHeads.Media.AVProVideo.MediaPlayer>().OpenVideoFromFile(RenderHeads.Media.AVProVideo.MediaPlayer.FileLocation.AbsolutePathOrURL, file_url, autoPlay);
                    // depthKitClip.RefreshRenderer();
                }
    #endif
#endif
            }
        }
예제 #2
0
        public IEnumerator VideoControllerPlayVideo()
        {
            videoControllerReady = true;

            if (videoPlayerType == VideoPlayerType.UnityPlayer)
            {
                controller.PlayVideo(vimeoVideo, selectedResolution);
            }
            else
            {
#if VIMEO_AVPRO_VIDEO_SUPPORT
                if (this.selectedResolution == StreamingResolution.Adaptive)
                {
                    yield return(Unfurl(vimeoVideo.GetAdaptiveVideoFileURL()));
                }
                else
                {
                    m_file_url = vimeoVideo.GetVideoFileUrlByResolution(selectedResolution);
                }

                if (videoPlayerType == VideoPlayerType.AVProVideo && mediaPlayer != null)
                {
                    mediaPlayer.OpenVideoFromFile(RenderHeads.Media.AVProVideo.MediaPlayer.FileLocation.AbsolutePathOrURL, m_file_url, autoPlay || playVideoAfterLoad);
                }
#endif // VIMEO_AVPRO_VIDEO_SUPPORT
#if VIMEO_DEPTHKIT_SUPPORT
                if (videoPlayerType == VideoPlayerType.Depthkit && depthKitClip != null)
                {
#if VIMEO_AVPRO_VIDEO_SUPPORT
                    if (depthKitClip.gameObject.GetComponent <RenderHeads.Media.AVProVideo.MediaPlayer>() != null)
                    {
                        depthKitClip.gameObject.GetComponent <RenderHeads.Media.AVProVideo.MediaPlayer>().OpenVideoFromFile(RenderHeads.Media.AVProVideo.MediaPlayer.FileLocation.AbsolutePathOrURL, m_file_url, autoPlay);
                    }
#endif // VIMEO_AVPRO_VIDEO_SUPPORT
                    if (depthKitClip.gameObject.GetComponent <VideoPlayer>() != null)
                    {
                        if (this.selectedResolution != StreamingResolution.Adaptive)
                        {
                            depthKitClip.gameObject.GetComponent <VideoPlayer>().url = vimeoVideo.GetVideoFileUrlByResolution(selectedResolution);
                        }
                        else
                        {
                            Debug.LogError("[Vimeo] Unity video player does not support adaptive video try selecting a specific quality in the Vimeo Player or use AVPro video on the Depthkit clip");
                        }
                    }
#if UNITY_2018_OR_NEWER
                    JSONNode metadata = vimeoVideo.GetMetadata();

                    if (metadata != null)
                    {
                        depthKitClip._metaDataFile          = new TextAsset(metadata.ToString());
                        depthKitClip._needToRefreshMetadata = true;
                        // This is a temporary hack to trigger the OnVideoStart event once the metadata loaded and will be replaced in the future
                        if (OnVideoStart != null)
                        {
                            OnVideoStart();
                        }
                    }
                    else
                    {
                        if (OnLoadError != null)
                        {
                            OnLoadError();
                        }
                    }
#else
                    Debug.LogError("[Vimeo] The Depthkit integration currently only supports Unity 2018 and higher");
#endif
                }
#endif // VIMEO_DEPTHKIT_SUPPORT
            }
            yield break;
        }
 public void PlayVideo(VimeoVideo _vimeoVideo, StreamingResolution resolution)
 {
     vimeoVideo = _vimeoVideo;
     PlayVideoByUrl(vimeoVideo.GetVideoFileUrlByResolution(resolution), vimeoVideo.is3D, vimeoVideo.stereoFormat);
 }
예제 #4
0
 public void GetVideoFileByResolution_Uses_Lowest_Resolution_If_Not_Found()
 {
     UnityEngine.TestTools.LogAssert.Expect(LogType.Log, new Regex("Defaulting to 400p"));
     video.GetVideoFileUrlByResolution(Vimeo.Player.StreamingResolution.x360p);
 }