Skip to content

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

Follow seeking while player is paused.

damencho7dad98111256
diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js
index 93a9023dc1..fb78754427 100644
--- a/modules/UI/shared_video/SharedVideo.js
+++ b/modules/UI/shared_video/SharedVideo.js
@@ -98,7 +98,7 @@ export default class SharedVideoManager {
window.onYouTubeIframeAPIReady = function() {
self.isPlayerAPILoaded = true;
let showControls = APP.conference.isLocalId(self.from) ? 1 : 0;
- new YT.Player('sharedVideoIFrame', {
+ let p = new YT.Player('sharedVideoIFrame', {
height: '100%',
width: '100%',
videoId: self.url,
@@ -114,8 +114,19 @@ export default class SharedVideoManager {
'onStateChange': onPlayerStateChange,
'onError': onPlayerError
}
- }).addEventListener(// add listener for volume changes
+ });
+
+ // add listener for volume changes
+ p.addEventListener(
"onVolumeChange", "onVolumeChange");
+
+ if (APP.conference.isLocalId(self.from)){
+ // adds progress listener that will be firing events
+ // while we are paused and we change the progress of the
+ // video (seeking forward or backward on the video)
+ p.addEventListener(
+ "onVideoProgress", "onVideoProgress");
+ }
};
window.onPlayerStateChange = function(event) {
@@ -138,6 +149,17 @@ export default class SharedVideoManager {
}
};
+ /**
+ * Track player progress while paused.
+ * @param event
+ */
+ window.onVideoProgress = function (event) {
+ let state = event.target.getPlayerState();
+ if (state == YT.PlayerState.PAUSED) {
+ self.updateCheck(true);
+ }
+ };
+
/**
* Gets notified for volume state changed.
* @param event
@@ -218,7 +240,7 @@ export default class SharedVideoManager {
// if its not paused, pause it
player.pauseVideo();
- this.processTime(player, attributes, !playerPaused);
+ this.processTime(player, attributes, true);
} else if (attributes.state == 'stop') {
this.stopSharedVideo(this.from);
}
@@ -233,6 +255,7 @@ export default class SharedVideoManager {
processTime (player, attributes, forceSeek)
{
if(forceSeek) {
+ console.info("Player seekTo:", attributes.time);
player.seekTo(attributes.time);
return;
}