private void VideoPlay(VideoController controller) { if (OnPlay != null) { OnPlay(); } }
private void VideoPaused(VideoController controller) { if (OnPause != null) { OnPause(); } }
private void VideoFrameReady(VideoController controller) { if (OnFrameReady != null) { OnFrameReady(); } }
// Events below private void VideoStarted(VideoController controller) { if (OnVideoStart != null) { OnVideoStart(); } }
private void VideoFinished(VideoController controller) { if (OnVideoFinish != null) { OnVideoFinish(); } }
private void Start() { if (!vimeoSignIn) { Debug.LogWarning("You have not signed into the Vimeo Player."); return; } if (vimeoVideoId == null || vimeoVideoId == "") { Debug.LogWarning("No Vimeo video URL was specified"); } if (GetVimeoToken() != null) { api = gameObject.AddComponent <VimeoApi>(); api.token = GetVimeoToken(); } if (videoScreen == null && videoPlayerType == VideoPlayerType.UnityPlayer) { Debug.LogWarning("No video screen was specified."); } if (videoPlayerType == VideoPlayerType.UnityPlayer) { // TODO abstract this out into a VideoPlayerManager (like EncoderManager.cs) controller = gameObject.AddComponent <VideoController>(); controller.videoScreenObject = videoScreen; controller.playerSettings = this; controller.OnVideoStart += VideoStarted; controller.OnPlay += VideoPlay; controller.OnPause += VideoPaused; controller.OnFrameReady += VideoFrameReady; } if (audioSource && audioSource is AudioSource) { if (audioSource != null) { controller.audioSource = audioSource; } else { videoScreen.gameObject.AddComponent <AudioSource>(); } } LoadVimeoVideoByUrl(vimeoVideoId); if (OnLoad != null) { OnLoad(); } }
// Events below private void VideoStarted(VideoController controller) { if (startTime > 0) { controller.SeekBySeconds(startTime); } if (OnVideoStart != null) { OnVideoStart(); } }
private void Start() { if (!vimeoSignIn) { Debug.LogWarning("You have not signed into the Vimeo Player."); return; } if (GetVimeoToken() != null) { api = gameObject.AddComponent <VimeoApi>(); api.token = GetVimeoToken(); api.OnRequestComplete += OnLoadVimeoVideoComplete; } if (videoScreen == null) { Debug.LogWarning("No video screen was specified."); } if (audioSource && audioSource.GetType() == typeof(GameObject)) { if (audioSource.GetComponent <AudioSource>() != null) { controller.audioSource = audioSource.GetComponent <AudioSource>(); } else { Debug.LogWarning("No AudioSource component found on " + audioSource.name + " GameObject"); } } controller = gameObject.AddComponent <VideoController>(); controller.videoScreenObject = videoScreen; controller.playerSettings = this; controller.OnVideoStart += VideoStarted; controller.OnPlay += VideoPlay; controller.OnPause += VideoPaused; // Bootup video if (vimeoVideoId != null && vimeoVideoId != "") { vimeoVideoId = Regex.Split(vimeoVideoId, "/?([0-9]+)")[1]; LoadVimeoVideo(int.Parse(vimeoVideoId)); } else { Debug.LogWarning("No Vimeo video ID was specified"); } }
private void SetupVideoController() { // TODO abstract this out into a VideoPlayerManager (like EncoderManager.cs) if (videoPlayerType == VideoPlayerType.UnityPlayer) { if (controller == null) { controller = gameObject.AddComponent <VideoController>(); controller.playerSettings = this; controller.videoScreenObject = videoScreen; controller.OnVideoStart += VideoStarted; controller.OnVideoFinish += VideoFinished; controller.OnPlay += VideoPlay; controller.OnPause += VideoPaused; controller.OnFrameReady += VideoFrameReady; if (audioSource && audioSource is AudioSource) { if (audioSource != null) { controller.audioSource = audioSource; } else { videoScreen.gameObject.AddComponent <AudioSource>(); } } } else if (videoPlayerType == VideoPlayerType.UnityPlayer) { controller.videoScreenObject = videoScreen; controller.Setup(); } } #if VIMEO_AVPRO_VIDEO_SUPPORT else if (videoPlayerType == VideoPlayerType.AVProVideo && mediaPlayer == null) { Debug.LogWarning("[Vimeo] AVPro MediaPlayer has not been assigned."); } #endif }