private static bool TryPlayMedia(MediaHelpers.MediaType mediaType, FileInfo file, BaseMediaPlayer player) { switch (mediaType) { case MediaHelpers.MediaType.Video: BaseVideoPlayer videoPlayer = player as BaseVideoPlayer; if (videoPlayer != null) { PlayOptions options = new PlayOptions(); options.Path = PATH_PREFIX + file.FullName; options.Type = BaseVideoPlayer.VideoType.Other; videoPlayer.Play(options); return(true); } break; case MediaHelpers.MediaType.Photo: BasePhotoPlayer photoPlayer = player as BasePhotoPlayer; if (photoPlayer != null) { photoPlayer.ShowPhoto(file); return(true); } break; default: Debug.LogError("Invalid Media Type."); break; } return(false); }
private IEnumerator QueuePlayCoroutine(PlayOptions options) { bool needsRestart = !string.IsNullOrEmpty(videoPlayer.videoURL); if (needsRestart) { Destroy(videoPlayer); videoPlayer = gameObject.AddComponent <GvrVideoPlayerTexture>(); videoPlayer.Screen = MediaScreen; } videoPlayer.videoType = (GvrVideoPlayerTexture.VideoType)options.Type; videoPlayer.videoURL = options.Path; yield return(new WaitForEndOfFrame()); videoPlayer.Init(); while (!videoPlayer.VideoReady) { yield return(new WaitForEndOfFrame()); } videoPlayer.Play(); queuedPlayCoroutine = null; yield return(null); }
private void QueuePlay(PlayOptions options) { if (queuedPlayCoroutine != null) { return; } queuedPlayCoroutine = StartCoroutine(QueuePlayCoroutine(options)); }
public override void Initialize(PlayOptions videoPlayOptions, long durationMilliseconds) { playOptions = videoPlayOptions; if (previousPath != playOptions.Path) { spriteCache.Clear(); previousPath = playOptions.Path; } pendingFrames.Clear(); pendingFramesToRequest.Clear(); activeRequestsCount = 0; videoDurationMilliseconds = durationMilliseconds; }
public void Play(PlayOptions options) { DestroyScreen(); PlayInternal(options); CurrentVideo = options; if (OnPlay != null) { OnPlay(); } DetectStereoProjectionFormat(); }
public abstract void Initialize(PlayOptions playOptions, long durationMilliseconds);
protected abstract void PlayInternal(PlayOptions options);
protected override void PlayInternal(PlayOptions options) { StopBriefUnpause(); StopQueuedPlay(); QueuePlay(options); }