fix(avatars): optimise

This commit is contained in:
Hristo Terezov 2020-02-25 16:54:20 +00:00
parent 94c48ec838
commit a7ac7790a8
2 changed files with 2 additions and 15 deletions

View File

@ -126,6 +126,7 @@ export default class RemoteVideo extends SmallVideo {
addRemoteVideoContainer() {
this.container = createContainer(this.videoSpanId);
this.$container = $(this.container);
this.initializeAvatar();
this._setThumbnailSize();
this.initBrowserSpecificProperties();
this.updateRemoteVideoMenu();

View File

@ -83,7 +83,6 @@ export default class SmallVideo {
*/
constructor(VideoLayout) {
this.isAudioMuted = false;
this.hasAvatar = false;
this.isVideoMuted = false;
this.videoStream = null;
this.audioStream = null;
@ -518,20 +517,9 @@ export default class SmallVideo {
}
/**
* Hides or shows the user's avatar.
* This update assumes that large video had been updated and we will
* reflect it on this small video.
* Updates the css classes of the thumbnail based on the current state.
*/
updateView() {
if (this.id) {
// Init / refresh avatar
this.initializeAvatar();
} else {
logger.error('Unable to init avatar - no id', this);
return;
}
this.$container.removeClass((index, classNames) =>
classNames.split(' ').filter(name => name.startsWith('display-')));
@ -581,8 +569,6 @@ export default class SmallVideo {
initializeAvatar() {
const thumbnail = this.$avatar().get(0);
this.hasAvatar = true;
if (thumbnail) {
// Maybe add a special case for local participant, as on init of
// LocalVideo.js the id is set to "local" but will get updated later.