Fixes setting of default display name in remote videos.

This commit is contained in:
yanas 2014-08-27 09:20:05 +02:00
parent c00f60f57b
commit eec2c487fd
3 changed files with 10 additions and 11 deletions

7
app.js
View File

@ -594,14 +594,9 @@ $(document).bind('joined.muc', function (event, jid, info) {
// Once we've joined the muc show the toolbar // Once we've joined the muc show the toolbar
Toolbar.showToolbar(); Toolbar.showToolbar();
var displayName = '';
if (info.displayName) if (info.displayName)
displayName = info.displayName + ' (me)';
else
displayName = "Me";
$(document).trigger('displaynamechanged', $(document).trigger('displaynamechanged',
['localVideoContainer', displayName]); ['localVideoContainer', info.displayName + ' (me)']);
}); });
$(document).bind('entered.muc', function (event, jid, info, pres) { $(document).bind('entered.muc', function (event, jid, info, pres) {

View File

@ -277,6 +277,5 @@
</div> </div>
<a id="downloadlog" onclick='dump(event.target);' data-toggle="popover" data-placement="right" data-content="Download logs" ><i class="fa fa-cloud-download"></i></a> <a id="downloadlog" onclick='dump(event.target);' data-toggle="popover" data-placement="right" data-content="Download logs" ><i class="fa fa-cloud-download"></i></a>
</div> </div>
</body> </body>
</html> </html>

View File

@ -28,6 +28,9 @@ var VideoLayout = (function (my) {
var localVideoContainer = document.getElementById('localVideoWrapper'); var localVideoContainer = document.getElementById('localVideoWrapper');
localVideoContainer.appendChild(localVideo); localVideoContainer.appendChild(localVideo);
// Set default display name.
setDisplayName('localVideoContainer');
AudioLevels.updateAudioLevelCanvas(); AudioLevels.updateAudioLevelCanvas();
var localVideoSelector = $('#' + localVideo.id); var localVideoSelector = $('#' + localVideo.id);
@ -103,7 +106,6 @@ var VideoLayout = (function (my) {
} }
}; };
/** /**
* Updates the large video with the given new video source. * Updates the large video with the given new video source.
*/ */
@ -306,6 +308,9 @@ var VideoLayout = (function (my) {
var container var container
= VideoLayout.addRemoteVideoContainer(peerJid, videoSpanId); = VideoLayout.addRemoteVideoContainer(peerJid, videoSpanId);
// Set default display name.
setDisplayName(videoSpanId);
var nickfield = document.createElement('span'); var nickfield = document.createElement('span');
nickfield.className = "nick"; nickfield.className = "nick";
nickfield.appendChild(document.createTextNode(resourceJid)); nickfield.appendChild(document.createTextNode(resourceJid));
@ -541,7 +546,7 @@ var VideoLayout = (function (my) {
editableText.className = 'displayname'; editableText.className = 'displayname';
editableText.id = 'editDisplayName'; editableText.id = 'editDisplayName';
if (displayName.length) { if (displayName && displayName.length) {
editableText.value editableText.value
= displayName.substring(0, displayName.indexOf(' (me)')); = displayName.substring(0, displayName.indexOf(' (me)'));
} }