Skip to content

Commit

Permalink
add NO-OP to use track methods and fix crash
Browse files Browse the repository at this point in the history
in _setLocalAudioVideoStreams on not a promise
  • Loading branch information
paweldomas committed Sep 10, 2021
1 parent 532fbd3 commit 9683c2b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ export default {
* @private
*/
_setLocalAudioVideoStreams(tracks = []) {
const promise = tracks.map(track => {
const promises = tracks.map(track => {
if (track.isAudioTrack()) {
return this.useAudioStream(track);
} else if (track.isVideoTrack()) {
Expand All @@ -1350,7 +1350,7 @@ export default {

});

return promise.then(() => {
return Promise.all(promises).then(() => {
this._localTracksInitialized = true;
logger.log(`Initialized with ${tracks.length} local tracks`);
});
Expand Down Expand Up @@ -1379,6 +1379,13 @@ export default {

logger.debug(`useVideoStream: Replacing ${oldTrack} with ${newTrack}`);

if (oldTrack === newTrack) {
resolve();
onFinish();

return;
}

APP.store.dispatch(
replaceLocalTrack(oldTrack, newTrack, room))
.then(() => {
Expand Down Expand Up @@ -1433,6 +1440,13 @@ export default {
_replaceLocalAudioTrackQueue.enqueue(onFinish => {
const oldTrack = getLocalJitsiAudioTrack(APP.store.getState());

if (oldTrack === newTrack) {
resolve();
onFinish();

return;
}

APP.store.dispatch(
replaceLocalTrack(oldTrack, newTrack, room))
.then(() => {
Expand Down

0 comments on commit 9683c2b

Please sign in to comment.