Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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;
 }
Ejemplo n.º 5
0
        public void Play(PlayOptions options)
        {
            DestroyScreen();

            PlayInternal(options);
            CurrentVideo = options;

            if (OnPlay != null)
            {
                OnPlay();
            }

            DetectStereoProjectionFormat();
        }
 public abstract void Initialize(PlayOptions playOptions, long durationMilliseconds);
Ejemplo n.º 7
0
 protected abstract void PlayInternal(PlayOptions options);
Ejemplo n.º 8
0
 protected override void PlayInternal(PlayOptions options)
 {
     StopBriefUnpause();
     StopQueuedPlay();
     QueuePlay(options);
 }