Apply user name as title on video streams

This commit is contained in:
Pierre HUBERT 2020-04-13 10:11:38 +02:00
parent c4e81d1ded
commit 4095ae5653

View File

@ -482,7 +482,7 @@ class CallWindow extends CustomEvents {
* @param {boolean} muted True to mute video * @param {boolean} muted True to mute video
* @param {MediaStream} stream Target stream * @param {MediaStream} stream Target stream
*/ */
applyStream(peerID, muted, stream) { async applyStream(peerID, muted, stream) {
// Remove any previous video stream // Remove any previous video stream
if(this.videoEls.has(peerID)) { if(this.videoEls.has(peerID)) {
@ -497,6 +497,7 @@ class CallWindow extends CustomEvents {
class: isVideo ? "video" : undefined class: isVideo ? "video" : undefined
}) })
// Apply video
const videoEl = document.createElement(isVideo ? "video" : "audio"); const videoEl = document.createElement(isVideo ? "video" : "audio");
videoContainer.appendChild(videoEl) videoContainer.appendChild(videoEl)
@ -507,6 +508,12 @@ class CallWindow extends CustomEvents {
this.videoEls.set(peerID, videoEl) this.videoEls.set(peerID, videoEl)
// Show user name
if(isVideo) {
const userName = (await user(peerID)).fullName
videoEl.title = userName
}
} }
/** /**
@ -552,7 +559,7 @@ class CallWindow extends CustomEvents {
return return
// Show user video // Show user video
this.applyStream(userID(), true, stream) await this.applyStream(userID(), true, stream)
this.mainPeer = new SimplePeer({ this.mainPeer = new SimplePeer({
initiator: true, initiator: true,