Make sure we store initial attributes in order, so it will hold the last state we want to be in. Respects quick initial stop received.
This commit is contained in:
parent
2e3dcb142d
commit
104503ee13
|
@ -1110,7 +1110,7 @@ export default {
|
|||
Commands.SHARED_VIDEO, ({value, attributes}, id) => {
|
||||
|
||||
if (attributes.state === 'stop') {
|
||||
APP.UI.stopSharedVideo(id);
|
||||
APP.UI.stopSharedVideo(id, attributes);
|
||||
} else if (attributes.state === 'start') {
|
||||
APP.UI.showSharedVideo(id, value, attributes);
|
||||
} else if (attributes.state === 'playing'
|
||||
|
|
|
@ -1115,7 +1115,7 @@ UI.updateSharedVideo = function (id, url, attributes) {
|
|||
*/
|
||||
UI.stopSharedVideo = function (id, attributes) {
|
||||
if (sharedVideoManager)
|
||||
sharedVideoManager.stopSharedVideo(id);
|
||||
sharedVideoManager.stopSharedVideo(id, attributes);
|
||||
};
|
||||
|
||||
module.exports = UI;
|
||||
|
|
|
@ -44,7 +44,8 @@ export default class SharedVideoManager {
|
|||
|
||||
if(APP.conference.isLocalId(this.from)) {
|
||||
showStopVideoPropmpt().then(() =>
|
||||
this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO, null, 'stop'));
|
||||
this.emitter.emit(
|
||||
UIEvents.UPDATE_SHARED_VIDEO, this.url, 'stop'));
|
||||
} else {
|
||||
messageHandler.openMessageDialog(
|
||||
"dialog.shareVideoTitle",
|
||||
|
@ -84,7 +85,7 @@ export default class SharedVideoManager {
|
|||
// we need to operate with player after start playing
|
||||
// self.player will be defined once it start playing
|
||||
// and will process any initial attributes if any
|
||||
this.initialAttributes = null;
|
||||
this.initialAttributes = attributes;
|
||||
|
||||
var self = this;
|
||||
if(self.isPlayerAPILoaded)
|
||||
|
@ -157,13 +158,6 @@ export default class SharedVideoManager {
|
|||
self.updateCheck.bind(self),
|
||||
updateInterval);
|
||||
}
|
||||
|
||||
if(self.player)
|
||||
self.processAttributes(
|
||||
self.player, attributes, self.playerPaused);
|
||||
else {
|
||||
self.initialAttributes = attributes;
|
||||
}
|
||||
};
|
||||
|
||||
window.onPlayerError = function(event) {
|
||||
|
@ -201,6 +195,8 @@ export default class SharedVideoManager {
|
|||
player.pauseVideo();
|
||||
|
||||
this.processTime(player, attributes, !playerPaused);
|
||||
} else if (attributes.state == 'stop') {
|
||||
this.stopSharedVideo(this.from);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,8 +232,10 @@ export default class SharedVideoManager {
|
|||
updateCheck(sendPauseEvent)
|
||||
{
|
||||
// ignore update checks if we are not the owner of the video
|
||||
// or there is still no player defined
|
||||
if(!APP.conference.isLocalId(this.from) || !this.player)
|
||||
// or there is still no player defined or we are stopped
|
||||
// (in a process of stopping)
|
||||
if(!APP.conference.isLocalId(this.from) || !this.player
|
||||
|| !this.isSharedVideoShown)
|
||||
return;
|
||||
|
||||
let state = this.player.getPlayerState();
|
||||
|
@ -287,13 +285,18 @@ export default class SharedVideoManager {
|
|||
* left and we want to remove video if the user sharing it left).
|
||||
* @param id the id of the sender of the command
|
||||
*/
|
||||
stopSharedVideo (id) {
|
||||
stopSharedVideo (id, attributes) {
|
||||
if (!this.isSharedVideoShown)
|
||||
return;
|
||||
|
||||
if(this.from !== id)
|
||||
return;
|
||||
|
||||
if(!this.player){
|
||||
this.initialAttributes = attributes;
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.intervalId) {
|
||||
clearInterval(this.intervalId);
|
||||
this.intervalId = null;
|
||||
|
|
Loading…
Reference in New Issue