|
@@ -98,7 +98,7 @@ export default class SharedVideoManager {
|
98
|
98
|
window.onYouTubeIframeAPIReady = function() {
|
99
|
99
|
self.isPlayerAPILoaded = true;
|
100
|
100
|
let showControls = APP.conference.isLocalId(self.from) ? 1 : 0;
|
101
|
|
- new YT.Player('sharedVideoIFrame', {
|
|
101
|
+ let p = new YT.Player('sharedVideoIFrame', {
|
102
|
102
|
height: '100%',
|
103
|
103
|
width: '100%',
|
104
|
104
|
videoId: self.url,
|
|
@@ -114,8 +114,19 @@ export default class SharedVideoManager {
|
114
|
114
|
'onStateChange': onPlayerStateChange,
|
115
|
115
|
'onError': onPlayerError
|
116
|
116
|
}
|
117
|
|
- }).addEventListener(// add listener for volume changes
|
|
117
|
+ });
|
|
118
|
+
|
|
119
|
+ // add listener for volume changes
|
|
120
|
+ p.addEventListener(
|
118
|
121
|
"onVolumeChange", "onVolumeChange");
|
|
122
|
+
|
|
123
|
+ if (APP.conference.isLocalId(self.from)){
|
|
124
|
+ // adds progress listener that will be firing events
|
|
125
|
+ // while we are paused and we change the progress of the
|
|
126
|
+ // video (seeking forward or backward on the video)
|
|
127
|
+ p.addEventListener(
|
|
128
|
+ "onVideoProgress", "onVideoProgress");
|
|
129
|
+ }
|
119
|
130
|
};
|
120
|
131
|
|
121
|
132
|
window.onPlayerStateChange = function(event) {
|
|
@@ -138,6 +149,17 @@ export default class SharedVideoManager {
|
138
|
149
|
}
|
139
|
150
|
};
|
140
|
151
|
|
|
152
|
+ /**
|
|
153
|
+ * Track player progress while paused.
|
|
154
|
+ * @param event
|
|
155
|
+ */
|
|
156
|
+ window.onVideoProgress = function (event) {
|
|
157
|
+ let state = event.target.getPlayerState();
|
|
158
|
+ if (state == YT.PlayerState.PAUSED) {
|
|
159
|
+ self.updateCheck(true);
|
|
160
|
+ }
|
|
161
|
+ };
|
|
162
|
+
|
141
|
163
|
/**
|
142
|
164
|
* Gets notified for volume state changed.
|
143
|
165
|
* @param event
|
|
@@ -218,7 +240,7 @@ export default class SharedVideoManager {
|
218
|
240
|
// if its not paused, pause it
|
219
|
241
|
player.pauseVideo();
|
220
|
242
|
|
221
|
|
- this.processTime(player, attributes, !playerPaused);
|
|
243
|
+ this.processTime(player, attributes, true);
|
222
|
244
|
} else if (attributes.state == 'stop') {
|
223
|
245
|
this.stopSharedVideo(this.from);
|
224
|
246
|
}
|
|
@@ -233,6 +255,7 @@ export default class SharedVideoManager {
|
233
|
255
|
processTime (player, attributes, forceSeek)
|
234
|
256
|
{
|
235
|
257
|
if(forceSeek) {
|
|
258
|
+ console.info("Player seekTo:", attributes.time);
|
236
|
259
|
player.seekTo(attributes.time);
|
237
|
260
|
return;
|
238
|
261
|
}
|