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