mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-10-31 02:04:53 +00:00 
			
		
		
		
	Apply user name as title on video streams
This commit is contained in:
		| @@ -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, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user