[RN] Add audio only mode for conferences
The behavior can be triggered with the toggleAudioOnly action, which is currently fired with a button. The following aspects of the conference will change when in audio only mode: - local video is muted - last N is set to 0 (effectively muting remote video) - full-screen mode is exited - audio mode is set to "audio chat" (default output is the earpiece) - the wake lock is disengaged One aspect not handled in this patch is disabling the video mute button while in audio only mode. The user should not be able to turn back video on in that case.
This commit is contained in:
committed by
Lyubo Marinov
parent
4ec4c45a90
commit
8fe3dce649
@@ -11,6 +11,8 @@ import {
|
||||
CONFERENCE_LEFT,
|
||||
CONFERENCE_WILL_LEAVE,
|
||||
LOCK_STATE_CHANGED,
|
||||
SET_AUDIO_ONLY,
|
||||
_SET_AUDIO_ONLY_VIDEO_MUTED,
|
||||
SET_PASSWORD,
|
||||
SET_ROOM
|
||||
} from './actionTypes';
|
||||
@@ -37,6 +39,12 @@ ReducerRegistry.register('features/base/conference', (state = {}, action) => {
|
||||
case LOCK_STATE_CHANGED:
|
||||
return _lockStateChanged(state, action);
|
||||
|
||||
case SET_AUDIO_ONLY:
|
||||
return _setAudioOnly(state, action);
|
||||
|
||||
case _SET_AUDIO_ONLY_VIDEO_MUTED:
|
||||
return _setAudioOnlyVideoMuted(state, action);
|
||||
|
||||
case SET_PASSWORD:
|
||||
return _setPassword(state, action);
|
||||
|
||||
@@ -71,6 +79,8 @@ function _conferenceFailed(state, action) {
|
||||
|
||||
return (
|
||||
setStateProperties(state, {
|
||||
audioOnly: undefined,
|
||||
audioOnlyVideoMuted: undefined,
|
||||
conference: undefined,
|
||||
leaving: undefined,
|
||||
locked: undefined,
|
||||
@@ -144,6 +154,8 @@ function _conferenceLeft(state, action) {
|
||||
|
||||
return (
|
||||
setStateProperties(state, {
|
||||
audioOnly: undefined,
|
||||
audioOnlyVideoMuted: undefined,
|
||||
conference: undefined,
|
||||
leaving: undefined,
|
||||
locked: undefined,
|
||||
@@ -200,6 +212,35 @@ function _lockStateChanged(state, action) {
|
||||
return setStateProperty(state, 'locked', action.locked || undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces a specific Redux action SET_AUDIO_ONLY of the feature
|
||||
* base/conference.
|
||||
*
|
||||
* @param {Object} state - The Redux state of the feature base/conference.
|
||||
* @param {Action} action - The Redux action SET_AUDIO_ONLY to reduce.
|
||||
* @private
|
||||
* @returns {Object} The new state of the feature base/conference after the
|
||||
* reduction of the specified action.
|
||||
*/
|
||||
function _setAudioOnly(state, action) {
|
||||
return setStateProperty(state, 'audioOnly', action.audioOnly);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces a specific Redux action _SET_AUDIO_ONLY_VIDEO_MUTED of the feature
|
||||
* base/conference.
|
||||
*
|
||||
* @param {Object} state - The Redux state of the feature base/conference.
|
||||
* @param {Action} action - The Redux action SET_AUDIO_ONLY_VIDEO_MUTED to
|
||||
* reduce.
|
||||
* @private
|
||||
* @returns {Object} The new state of the feature base/conference after the
|
||||
* reduction of the specified action.
|
||||
*/
|
||||
function _setAudioOnlyVideoMuted(state, action) {
|
||||
return setStateProperty(state, 'audioOnlyVideoMuted', action.muted);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces a specific Redux action SET_PASSWORD of the feature base/conference.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user