mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 04:15:17 +00:00
Keep track of remote streams
This commit is contained in:
@ -23,6 +23,9 @@ class CallWindow extends CustomEvents {
|
|||||||
/** @type {Map<number, Peer>} */
|
/** @type {Map<number, Peer>} */
|
||||||
this.peersEls = new Map()
|
this.peersEls = new Map()
|
||||||
|
|
||||||
|
/** @type {Map<number, SimplePeer>} */
|
||||||
|
this.streamsEls = new Map()
|
||||||
|
|
||||||
/** @type {Map<number, HTMLVideoElement>} */
|
/** @type {Map<number, HTMLVideoElement>} */
|
||||||
this.videoEls = new Map()
|
this.videoEls = new Map()
|
||||||
|
|
||||||
@ -524,6 +527,11 @@ class CallWindow extends CustomEvents {
|
|||||||
this.peersEls.delete(userID)
|
this.peersEls.delete(userID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove associated stream
|
||||||
|
if(this.streamsEls.has(userID)) {
|
||||||
|
this.streamsEls.delete(userID)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -844,6 +852,7 @@ class CallWindow extends CustomEvents {
|
|||||||
peer.on("stream", stream => {
|
peer.on("stream", stream => {
|
||||||
console.log("Got remote peer stream", stream)
|
console.log("Got remote peer stream", stream)
|
||||||
|
|
||||||
|
this.streamsEls.set(peerID, stream)
|
||||||
this.applyStream(peerID, false, stream)
|
this.applyStream(peerID, false, stream)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user