ref(LargeVideoManager): getCurrentContainer
Remove duplication and direct access to kind of private 'state' field by introducing 'getCurrentContainer' method.
This commit is contained in:
parent
2281b1acd2
commit
badbedf0f5
|
@ -116,7 +116,8 @@ export default class LargeVideoManager {
|
||||||
if (!this.state) {
|
if (!this.state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let container = this.getContainer(this.state);
|
const container = this.getCurrentContainer();
|
||||||
|
|
||||||
container.onHoverIn(e);
|
container.onHoverIn(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +125,8 @@ export default class LargeVideoManager {
|
||||||
if (!this.state) {
|
if (!this.state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let container = this.getContainer(this.state);
|
const container = this.getCurrentContainer();
|
||||||
|
|
||||||
container.onHoverOut(e);
|
container.onHoverOut(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +150,7 @@ export default class LargeVideoManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
get id () {
|
get id () {
|
||||||
let container = this.getContainer(this.state);
|
const container = this.getCurrentContainer();
|
||||||
return container.id;
|
return container.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +163,7 @@ export default class LargeVideoManager {
|
||||||
|
|
||||||
// Include hide()/fadeOut only if we're switching between users
|
// Include hide()/fadeOut only if we're switching between users
|
||||||
const isUserSwitch = this.newStreamData.id != this.id;
|
const isUserSwitch = this.newStreamData.id != this.id;
|
||||||
const container = this.getContainer(this.state);
|
const container = this.getCurrentContainer();
|
||||||
const preUpdate = isUserSwitch ? container.hide() : Promise.resolve();
|
const preUpdate = isUserSwitch ? container.hide() : Promise.resolve();
|
||||||
|
|
||||||
preUpdate.then(() => {
|
preUpdate.then(() => {
|
||||||
|
@ -177,7 +179,7 @@ export default class LargeVideoManager {
|
||||||
|
|
||||||
logger.info("hover in %s", id);
|
logger.info("hover in %s", id);
|
||||||
this.state = videoType;
|
this.state = videoType;
|
||||||
const container = this.getContainer(this.state);
|
const container = this.getCurrentContainer();
|
||||||
container.setStream(id, stream, videoType);
|
container.setStream(id, stream, videoType);
|
||||||
|
|
||||||
// change the avatar url on large
|
// change the avatar url on large
|
||||||
|
@ -509,6 +511,18 @@ export default class LargeVideoManager {
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@link LargeContainer} for the current {@link state}
|
||||||
|
*
|
||||||
|
* @return {LargeContainer}
|
||||||
|
*
|
||||||
|
* @throws an <tt>Error</tt> if there is no container for the current
|
||||||
|
* {@link state}.
|
||||||
|
*/
|
||||||
|
getCurrentContainer() {
|
||||||
|
return this.getContainer(this.state);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove Large container of specified type.
|
* Remove Large container of specified type.
|
||||||
* @param {string} type container type.
|
* @param {string} type container type.
|
||||||
|
|
|
@ -981,7 +981,7 @@ var VideoLayout = {
|
||||||
* video.
|
* video.
|
||||||
*/
|
*/
|
||||||
getCurrentlyOnLargeContainer () {
|
getCurrentlyOnLargeContainer () {
|
||||||
return largeVideo.getContainer(largeVideo.state);
|
return largeVideo.getCurrentContainer();
|
||||||
},
|
},
|
||||||
|
|
||||||
isCurrentlyOnLarge (id) {
|
isCurrentlyOnLarge (id) {
|
||||||
|
|
Loading…
Reference in New Issue