1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

Clean up stopAllMedia

This commit is contained in:
Robert Long
2021-09-15 12:38:12 -07:00
parent c4d7fef0cd
commit f3a2bd6b40

View File

@@ -1747,19 +1747,15 @@ export class MatrixCall extends EventEmitter {
logger.debug(`stopAllMedia (stream=${this.localUsermediaStream})`);
for (const feed of this.feeds) {
if (feed.isLocal()) {
if (feed.purpose === SDPStreamMetadataPurpose.Usermedia) {
this.client.getMediaHandler().stopUserMediaStream(feed.stream);
continue;
} else if (feed.purpose === SDPStreamMetadataPurpose.Screenshare) {
this.client.getMediaHandler().stopScreensharingStream(feed.stream);
continue;
if (feed.isLocal() && feed.purpose === SDPStreamMetadataPurpose.Usermedia) {
this.client.getMediaHandler().stopUserMediaStream(feed.stream);
} else if (feed.isLocal() && feed.purpose === SDPStreamMetadataPurpose.Screenshare) {
this.client.getMediaHandler().stopScreensharingStream(feed.stream);
} else {
for (const track of feed.stream.getTracks()) {
track.stop();
}
}
for (const track of feed.stream.getTracks()) {
track.stop();
}
}
}