|
|
|
@ -592,7 +592,7 @@ export default { |
|
|
|
|
const handleInitialTracks = (options, tracks) => { |
|
|
|
|
let localTracks = tracks; |
|
|
|
|
|
|
|
|
|
if (options.startWithAudioMuted || room?.isStartAudioMuted()) { |
|
|
|
|
if (options.startWithAudioMuted) { |
|
|
|
|
// Always add the track on Safari because of a known issue where audio playout doesn't happen
|
|
|
|
|
// if the user joins audio and video muted, i.e., if there is no local media capture.
|
|
|
|
|
if (browser.isWebKitBased()) { |
|
|
|
@ -601,64 +601,38 @@ export default { |
|
|
|
|
localTracks = localTracks.filter(track => track.getType() !== MEDIA_TYPE.AUDIO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (room?.isStartVideoMuted()) { |
|
|
|
|
localTracks = localTracks.filter(track => track.getType() !== MEDIA_TYPE.VIDEO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return localTracks; |
|
|
|
|
}; |
|
|
|
|
const { dispatch } = APP.store; |
|
|
|
|
const { dispatch, getState } = APP.store; |
|
|
|
|
const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks(initialOptions); |
|
|
|
|
|
|
|
|
|
if (isPrejoinPageVisible(state)) { |
|
|
|
|
const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks(initialOptions); |
|
|
|
|
const localTracks = await tryCreateLocalTracks; |
|
|
|
|
dispatch(setInitialGUMPromise(tryCreateLocalTracks.then(async tr => { |
|
|
|
|
const tracks = handleInitialTracks(initialOptions, tr); |
|
|
|
|
|
|
|
|
|
// Initialize device list a second time to ensure device labels get populated in case of an initial gUM
|
|
|
|
|
// acceptance; otherwise they may remain as empty strings.
|
|
|
|
|
this._initDeviceList(true); |
|
|
|
|
|
|
|
|
|
if (isPrejoinPageVisible(state)) { |
|
|
|
|
if (isPrejoinPageVisible(getState())) { |
|
|
|
|
dispatch(gumPending([ MEDIA_TYPE.AUDIO, MEDIA_TYPE.VIDEO ], IGUMPendingState.NONE)); |
|
|
|
|
dispatch(setInitialGUMPromise()); |
|
|
|
|
|
|
|
|
|
return dispatch(initPrejoin(localTracks, errors)); |
|
|
|
|
// Note: Not sure if initPrejoin needs to be async. But let's wait for it just to be sure the
|
|
|
|
|
// tracks are added.
|
|
|
|
|
await dispatch(initPrejoin(tracks, errors)); |
|
|
|
|
} else { |
|
|
|
|
APP.store.dispatch(displayErrorsForCreateInitialLocalTracks(errors)); |
|
|
|
|
setGUMPendingStateOnFailedTracks(tracks, APP.store.dispatch); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
logger.debug('Prejoin screen no longer displayed at the time when tracks were created'); |
|
|
|
|
|
|
|
|
|
APP.store.dispatch(displayErrorsForCreateInitialLocalTracks(errors)); |
|
|
|
|
|
|
|
|
|
const tracks = handleInitialTracks(initialOptions, localTracks); |
|
|
|
|
|
|
|
|
|
setGUMPendingStateOnFailedTracks(tracks, APP.store.dispatch); |
|
|
|
|
return { |
|
|
|
|
tracks, |
|
|
|
|
errors |
|
|
|
|
}; |
|
|
|
|
}))); |
|
|
|
|
|
|
|
|
|
return this._setLocalAudioVideoStreams(tracks); |
|
|
|
|
if (!isPrejoinPageVisible(getState())) { |
|
|
|
|
dispatch(connect()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks(initialOptions); |
|
|
|
|
const gumPromise = tryCreateLocalTracks.then(tr => { |
|
|
|
|
APP.store.dispatch(displayErrorsForCreateInitialLocalTracks(errors)); |
|
|
|
|
|
|
|
|
|
return tr; |
|
|
|
|
}).then(tr => { |
|
|
|
|
this._initDeviceList(true); |
|
|
|
|
|
|
|
|
|
const filteredTracks = handleInitialTracks(initialOptions, tr); |
|
|
|
|
|
|
|
|
|
setGUMPendingStateOnFailedTracks(filteredTracks, APP.store.dispatch); |
|
|
|
|
|
|
|
|
|
return filteredTracks; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return Promise.all([ |
|
|
|
|
gumPromise, |
|
|
|
|
dispatch(connect()) |
|
|
|
|
]).catch(e => { |
|
|
|
|
dispatch(setInitialGUMPromise(gumPromise)); |
|
|
|
|
throw e; |
|
|
|
|
}) |
|
|
|
|
.then(([ tracks, _ ]) => { |
|
|
|
|
this.startConference(tracks).catch(logger.error); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|