Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Seeks in video when we start in paused state.

damencho7c02803ef978
diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js
index 0ced143a49..9a8e5a857a 100644
--- a/modules/UI/shared_video/SharedVideo.js
+++ b/modules/UI/shared_video/SharedVideo.js
@@ -177,17 +177,7 @@ export default class SharedVideoManager {
if (attributes.state == 'playing') {
- // check received time and current time
- let currentPosition = player.getCurrentTime();
- let diff = Math.abs(attributes.time - currentPosition);
-
- // if we drift more than the interval for checking
- // sync, the interval is in milliseconds
- if(diff > updateInterval/1000) {
- console.info("DDD Player seekTo:", attributes.time,
- " current time is:", currentPosition, " diff:", diff);
- player.seekTo(attributes.time);
- }
+ this.processTime(player, attributes);
// lets check the volume
if (attributes.volume !== undefined &&
@@ -202,6 +192,28 @@ export default class SharedVideoManager {
} else if (attributes.state == 'pause') {
// if its not paused, pause it
player.pauseVideo();
+
+ this.processTime(player, attributes);
+ }
+ }
+
+ /**
+ * Check for time in attributes and if needed seek in current player
+ * @param player the player to operate over
+ * @param attributes the attributes with the player state we want
+ */
+ processTime (player, attributes)
+ {
+ // check received time and current time
+ let currentPosition = player.getCurrentTime();
+ let diff = Math.abs(attributes.time - currentPosition);
+
+ // if we drift more than the interval for checking
+ // sync, the interval is in milliseconds
+ if(diff > updateInterval/1000) {
+ console.info("Player seekTo:", attributes.time,
+ " current time is:", currentPosition, " diff:", diff);
+ player.seekTo(attributes.time);
}
}
@@ -219,7 +231,7 @@ export default class SharedVideoManager {
// if its paused and haven't been pause - send paused
if (state === YT.PlayerState.PAUSED && sendPauseEvent) {
this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO,
- this.url, 'pause');
+ this.url, 'pause', this.player.getCurrentTime());
}
// if its playing and it was paused - send update with time
// if its playing and was playing just send update with time