From b2c0d75723fb70ab703b68715623d54cdeaa4987 Mon Sep 17 00:00:00 2001 From: fo Date: Wed, 3 Sep 2014 11:57:41 +0300 Subject: [PATCH] Change the default display name. --- videolayout.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/videolayout.js b/videolayout.js index 0dd907c24..fb2d39305 100644 --- a/videolayout.js +++ b/videolayout.js @@ -1,6 +1,8 @@ var VideoLayout = (function (my) { var preMuted = false; var currentDominantSpeaker = null; + var defaultRemoteDisplayName = "Fellow Jitster"; + var defaultDominantSpeakerDisplayName = "Speaker"; var lastNCount = config.channelLastN; var lastNEndpointsCache = []; var largeVideoNewSrc = ''; @@ -512,7 +514,6 @@ var VideoLayout = (function (my) { function setDisplayName(videoSpanId, displayName) { var nameSpan = $('#' + videoSpanId + '>span.displayname'); var defaultLocalDisplayName = "Me"; - var defaultRemoteDisplayName = "Speaker"; // If we already have a display name for this video. if (nameSpan.length > 0) { @@ -1196,10 +1197,19 @@ var VideoLayout = (function (my) { return; // Update the current dominant speaker. - if (resourceJid !== currentDominantSpeaker) + if (resourceJid !== currentDominantSpeaker) { + var oldSpeakerVideoSpanId = "participant_" + currentDominantSpeaker, + newSpeakerVideoSpanId = "participant_" + resourceJid; + if($("#" + oldSpeakerVideoSpanId + ">span.displayname").text() === defaultDominantSpeakerDisplayName) { + setDisplayName(oldSpeakerVideoSpanId, null); + } + if($("#" + newSpeakerVideoSpanId + ">span.displayname").text() === defaultRemoteDisplayName) { + setDisplayName(newSpeakerVideoSpanId, defaultDominantSpeakerDisplayName); + } currentDominantSpeaker = resourceJid; - else + } else { return; + } // Obtain container for new dominant speaker. var container = document.getElementById(