From ad259988b9626b0db014b91de9b4c93ac57e5580 Mon Sep 17 00:00:00 2001 From: Daniel Ornelas Date: Mon, 18 Jun 2018 10:19:59 -0500 Subject: [PATCH] [RN] Fix for creating video track when conference is ending. --- react/features/base/conference/actions.js | 14 ++++++++++---- react/features/base/conference/middleware.js | 2 +- react/features/base/media/middleware.js | 2 +- react/features/base/settings/middleware.js | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.js index 0f9abe049..1368c243d 100644 --- a/react/features/base/conference/actions.js +++ b/react/features/base/conference/actions.js @@ -451,15 +451,21 @@ export function p2pStatusChanged(p2p: boolean) { * * @param {boolean} audioOnly - True if the conference should be audio only; * false, otherwise. + * @param {boolean} ensureVideoTrack - Define if conference should ensure + * to create a video track. * @returns {{ * type: SET_AUDIO_ONLY, - * audioOnly: boolean + * audioOnly: boolean, + * ensureVideoTrack: boolean * }} */ -export function setAudioOnly(audioOnly: boolean) { +export function setAudioOnly( + audioOnly: boolean, + ensureVideoTrack: boolean = false) { return { type: SET_AUDIO_ONLY, - audioOnly + audioOnly, + ensureVideoTrack }; } @@ -665,6 +671,6 @@ export function toggleAudioOnly() { return (dispatch: Dispatch<*>, getState: Function) => { const { audioOnly } = getState()['features/base/conference']; - return dispatch(setAudioOnly(!audioOnly)); + return dispatch(setAudioOnly(!audioOnly, true)); }; } diff --git a/react/features/base/conference/middleware.js b/react/features/base/conference/middleware.js index b997b7eb2..59c3cdcd0 100644 --- a/react/features/base/conference/middleware.js +++ b/react/features/base/conference/middleware.js @@ -273,7 +273,7 @@ function _setAudioOnly({ dispatch, getState }, next, action) { setVideoMuted( newValue, VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY, - /* ensureTrack */ true)); + action.ensureVideoTrack)); if (typeof APP !== 'undefined') { // TODO This should be a temporary solution that lasts only until video diff --git a/react/features/base/media/middleware.js b/react/features/base/media/middleware.js index a1880d73e..6bbb784ea 100644 --- a/react/features/base/media/middleware.js +++ b/react/features/base/media/middleware.js @@ -162,7 +162,7 @@ function _setRoom({ dispatch, getState }, next, action) { sendAnalytics(createStartAudioOnlyEvent(audioOnly)); logger.log(`Start audio only set to ${audioOnly.toString()}`); - dispatch(setAudioOnly(audioOnly)); + dispatch(setAudioOnly(audioOnly, false)); return next(action); } diff --git a/react/features/base/settings/middleware.js b/react/features/base/settings/middleware.js index 15f649d6c..db67ef0a1 100644 --- a/react/features/base/settings/middleware.js +++ b/react/features/base/settings/middleware.js @@ -55,7 +55,7 @@ function _maybeSetAudioOnly( { dispatch }, { settings: { startAudioOnly } }) { if (typeof startAudioOnly === 'boolean') { - dispatch(setAudioOnly(startAudioOnly)); + dispatch(setAudioOnly(startAudioOnly, true)); } }