public override void OnVideoStart() { DebugLog("Video start"); if (Networking.IsOwner(gameObject)) { localPlayerState = PLAYER_STATE_PLAYING; _playStartTime = Time.time; _syncVideoStartNetworkTime = (float)Networking.GetServerTimeInSeconds() - _videoTargetTime; _syncOwnerPlaying = true; RequestSerialization(); _currentPlayer.SetTime(_videoTargetTime); } else { if (!_syncOwnerPlaying) { // TODO: Owner bypass _currentPlayer.Pause(); _waitForSync = true; } else { localPlayerState = PLAYER_STATE_PLAYING; _playStartTime = Time.time; SyncVideo(); } } }
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(); }
// 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); }
public override void OnVideoStart() { if (Networking.IsOwner(gameObject)) { _videoStartNetworkTime = (float)Networking.GetServerTimeInSeconds(); _ownerPlaying = true; } else if (!_ownerPlaying) // Watchers pause and wait for sync from owner { _currentPlayer.Pause(); _waitForSync = true; } }
// 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]; } } }
public void Pause() { vPlayer.Pause(); }