|
|
|
@ -1,27 +1,30 @@ |
|
|
|
|
// @flow
|
|
|
|
|
|
|
|
|
|
declare var JitsiMeetJS: Object; |
|
|
|
|
declare var APP: Object; |
|
|
|
|
|
|
|
|
|
import uuid from 'uuid'; |
|
|
|
|
|
|
|
|
|
import { getDialOutStatusUrl, getDialOutUrl } from '../base/config/functions'; |
|
|
|
|
import { getDialOutStatusUrl, getDialOutUrl, updateConfig } from '../base/config'; |
|
|
|
|
import { isIosMobileBrowser } from '../base/environment/utils'; |
|
|
|
|
import { createLocalTrack } from '../base/lib-jitsi-meet'; |
|
|
|
|
import { isVideoMutedByUser } from '../base/media'; |
|
|
|
|
import { isVideoMutedByUser, MEDIA_TYPE } from '../base/media'; |
|
|
|
|
import { updateSettings } from '../base/settings'; |
|
|
|
|
import { |
|
|
|
|
createLocalTracksF, |
|
|
|
|
getLocalAudioTrack, |
|
|
|
|
getLocalTracks, |
|
|
|
|
getLocalVideoTrack, |
|
|
|
|
trackAdded, |
|
|
|
|
replaceLocalTrack |
|
|
|
|
} from '../base/tracks'; |
|
|
|
|
import { createLocalTracksF } from '../base/tracks/functions'; |
|
|
|
|
import { openURLInBrowser } from '../base/util'; |
|
|
|
|
import { executeDialOutRequest, executeDialOutStatusRequest, getDialInfoPageURL } from '../invite/functions'; |
|
|
|
|
import { showErrorNotification } from '../notifications'; |
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
PREJOIN_JOINING_IN_PROGRESS, |
|
|
|
|
PREJOIN_INITIALIZED, |
|
|
|
|
PREJOIN_START_CONFERENCE, |
|
|
|
|
SET_DEVICE_STATUS, |
|
|
|
|
SET_DIALOUT_COUNTRY, |
|
|
|
|
SET_DIALOUT_NUMBER, |
|
|
|
|
SET_DIALOUT_STATUS, |
|
|
|
@ -31,9 +34,10 @@ import { |
|
|
|
|
SET_JOIN_BY_PHONE_DIALOG_VISIBLITY, |
|
|
|
|
SET_PRECALL_TEST_RESULTS, |
|
|
|
|
SET_PREJOIN_DEVICE_ERRORS, |
|
|
|
|
SET_PREJOIN_PAGE_VISIBILITY |
|
|
|
|
SET_PREJOIN_PAGE_VISIBILITY, |
|
|
|
|
SET_DEVICE_STATUS |
|
|
|
|
} from './actionTypes'; |
|
|
|
|
import { type PREJOIN_SCREEN_STATE } from './constants'; |
|
|
|
|
import { type PREJOIN_SCREEN_STATE, PREJOIN_SCREEN_STATES } from './constants'; |
|
|
|
|
import { |
|
|
|
|
getFullDialOutNumber, |
|
|
|
|
getDialOutConferenceUrl, |
|
|
|
@ -209,15 +213,74 @@ export function initPrejoin(tracks: Object[], errors: Object) { |
|
|
|
|
* Action used to start the conference. |
|
|
|
|
* |
|
|
|
|
* @param {Object} options - The config options that override the default ones (if any). |
|
|
|
|
* @param {boolean} ignoreJoiningInProgress - If true we won't check the joiningInProgress flag. |
|
|
|
|
* @returns {Function} |
|
|
|
|
*/ |
|
|
|
|
export function joinConference(options?: Object) { |
|
|
|
|
export function joinConference(options?: Object, ignoreJoiningInProgress: boolean = false) { |
|
|
|
|
return async function(dispatch: Function, getState: Function) { |
|
|
|
|
if (!ignoreJoiningInProgress) { |
|
|
|
|
const state = getState(); |
|
|
|
|
const { joiningInProgress } = state['features/prejoin']; |
|
|
|
|
|
|
|
|
|
if (joiningInProgress) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
dispatch(setJoiningInProgress(true)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const state = getState(); |
|
|
|
|
const { userSelectedSkipPrejoin } = state['features/prejoin']; |
|
|
|
|
let localTracks = getLocalTracks(state['features/base/tracks']); |
|
|
|
|
|
|
|
|
|
options && dispatch(updateConfig(options)); |
|
|
|
|
|
|
|
|
|
userSelectedSkipPrejoin && dispatch(updateSettings({ |
|
|
|
|
userSelectedSkipPrejoin |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
// Do not signal audio/video tracks if the user joins muted.
|
|
|
|
|
for (const track of localTracks) { |
|
|
|
|
// Always add the audio track on mobile Safari because of a known issue where audio playout doesn't happen
|
|
|
|
|
// if the user joins audio and video muted.
|
|
|
|
|
if (track.muted |
|
|
|
|
&& !(isIosMobileBrowser() && track.jitsiTrack && track.jitsiTrack.getType() === MEDIA_TYPE.AUDIO)) { |
|
|
|
|
try { |
|
|
|
|
await dispatch(replaceLocalTrack(track.jitsiTrack, null)); |
|
|
|
|
} catch (error) { |
|
|
|
|
logger.error(`Failed to replace local track (${track.jitsiTrack}) with null: ${error}`); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Re-fetch the local tracks after muted tracks have been removed above.
|
|
|
|
|
// This is needed, because the tracks are effectively disposed by the replaceLocalTrack and should not be used
|
|
|
|
|
// anymore.
|
|
|
|
|
localTracks = getLocalTracks(getState()['features/base/tracks']); |
|
|
|
|
|
|
|
|
|
const jitsiTracks = localTracks.map(t => t.jitsiTrack); |
|
|
|
|
|
|
|
|
|
dispatch(setPrejoinPageVisibility(PREJOIN_SCREEN_STATES.LOADING)); |
|
|
|
|
|
|
|
|
|
APP.conference.prejoinStart(jitsiTracks); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Action used to set the flag for joining operation in progress. |
|
|
|
|
* |
|
|
|
|
* @param {boolean} value - The config options that override the default ones (if any). |
|
|
|
|
* @returns {Function} |
|
|
|
|
*/ |
|
|
|
|
export function setJoiningInProgress(value: boolean) { |
|
|
|
|
return { |
|
|
|
|
type: PREJOIN_START_CONFERENCE, |
|
|
|
|
options |
|
|
|
|
type: PREJOIN_JOINING_IN_PROGRESS, |
|
|
|
|
value |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Joins the conference without audio. |
|
|
|
|
* |
|
|
|
@ -225,16 +288,28 @@ export function joinConference(options?: Object) { |
|
|
|
|
*/ |
|
|
|
|
export function joinConferenceWithoutAudio() { |
|
|
|
|
return async function(dispatch: Function, getState: Function) { |
|
|
|
|
const tracks = getState()['features/base/tracks']; |
|
|
|
|
const state = getState(); |
|
|
|
|
const { joiningInProgress } = state['features/prejoin']; |
|
|
|
|
|
|
|
|
|
if (joiningInProgress) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
dispatch(setJoiningInProgress(true)); |
|
|
|
|
const tracks = state['features/base/tracks']; |
|
|
|
|
const audioTrack = getLocalAudioTrack(tracks)?.jitsiTrack; |
|
|
|
|
|
|
|
|
|
if (audioTrack) { |
|
|
|
|
await dispatch(replaceLocalTrack(audioTrack, null)); |
|
|
|
|
try { |
|
|
|
|
await dispatch(replaceLocalTrack(audioTrack, null)); |
|
|
|
|
} catch (error) { |
|
|
|
|
logger.error(`Failed to replace local audio with null: ${error}`); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
dispatch(joinConference({ |
|
|
|
|
startSilent: true |
|
|
|
|
})); |
|
|
|
|
}, true)); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|