Example #1
0
        public override void OnVideoReady()
        {
            float duration = _currentPlayer.GetDuration();

            DebugLog("Video ready, duration: " + duration + ", position: " + _currentPlayer.GetTime());

            // If a seekable video is loaded it should have a positive duration.  Otherwise we assume it's a non-seekable stream
            seekableSource = !float.IsInfinity(duration) && !float.IsNaN(duration) && duration > 1;

            // If player is owner: play video
            // If Player is remote:
            //   - If owner playing state is already synced, play video
            //   - Otherwise, wait until owner playing state is synced and play later in update()
            //   TODO: Streamline by always doing this in update instead?

            if (Networking.IsOwner(gameObject))
            {
                _currentPlayer.Play();
            }
            else
            {
                // TODO: Stream bypass owner
                if (_syncOwnerPlaying)
                {
                    _currentPlayer.Play();
                }
                else
                {
                    _waitForSync = true;
                }
            }
        }
Example #2
0
 public override void OnVideoReady()
 {
     if (Networking.IsOwner(gameObject)) // The owner plays the video when it is ready
     {
         _currentPlayer.Play();
     }
     else // If the owner is playing the video, Play it and run SyncVideo
     {
         if (_ownerPlaying)
         {
             _currentPlayer.Play();
             SyncVideo();
         }
         else
         {
             _waitForSync = true;
         }
     }
 }
Example #3
0
 public override void OnVideoReady()
 {
     if (!_player)
     {
         return;
     }
     DebugLog($"The video is ready.");
     _status = _status & ~_status_fetch | _status_play;
     if (float.IsInfinity(_player.GetDuration()))
     {
         _status = _status | _status_stream;
     }
     SetElapsedTime(_timeSync);
     _player.Play();
     if (IsStatus(_status_pause))
     {
         _player.Pause();
     }
     ValidateView();
 }
Example #4
0
        // for late joiners
        public void SeekToSlide(int slideIndex)
        {
            PauseContinuous();
            mainPlayerController.Play();
            currSlide = Mathf.Clamp(slideIndex, 0, slideDurations.Length - 1);
            var startTime = GetSlideStart();

            mainPlayerController.SetTime(startTime + 0.3f);
            Debug.Log($"ut: seeked to slide {currSlide}, time {startTime}");
            if (isOwner)
            {
                if (currSlide + 1 != slideDurations.Length)
                {
                    lookaheadPlayer.Play();
                    lookaheadPlayer.SetTime(GetNextSlideEnd(startTime));
                    lookaheadPlayer.Pause();
                }
            }

            if (!shouldAutoplay[currSlide])
            {
                mainPlayerController.Pause();
            }
            else
            {
                playingContinuously = true;
                if (currSlide + 1 == slideDurations.Length)
                {
                    shouldStopAt = float.MaxValue;
                }
                else
                {
                    shouldStopAt = startTime + slideDurations[currSlide];
                }
            }
        }
Example #5
0
        // Pauses videos and stops streams
        public void TriggerPauseButton()
        {
            if (!Networking.IsOwner(gameObject))
            {
                return;
            }

            _ownerPaused = !_ownerPaused;

            if (currentPlayerMode == PLAYER_MODE_VIDEO ||
                currentPlayerMode == PLAYER_MODE_KARAOKE)
            {
                if (_ownerPaused)
                {
                    _currentPlayer.Pause();
                    _locallyPaused = true;
                }
                else
                {
                    _currentPlayer.Play();
                }
            }
            else
            {
                if (_ownerPaused)
                {
                    _currentPlayer.Pause();
                    _locallyPaused = true;
                }
                else
                {
                    _currentPlayer.Play();
                    _currentPlayer.SetTime(float.MaxValue);
                }
            }

            playIcon.SetActive(_ownerPaused);
            pauseStopIcon.SetActive(!_ownerPaused);
        }
Example #6
0
 public void Play()
 {
     vPlayer.Play();
 }