mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
As an intermediate step on the path to merging jitsi-meet and
jitsi-meet-react, import the whole source code of jitsi-meet-react as it
stands at
2f23d98424
i.e. the lastest master at the time of this import. No modifications are
applied to the imported source code in order to preserve a complete
snapshot of it in the repository of jitsi-meet and, thus, facilitate
comparison later on. Consequently, the source code of jitsi-meet and/or
jitsi-meet-react may not work. For example, jitsi-meet's jshint may be
unable to parse jitsi-meet-react's source code.
102 lines
2.3 KiB
JavaScript
102 lines
2.3 KiB
JavaScript
import {
|
|
AUDIO_MUTED_CHANGED,
|
|
CAMERA_FACING_MODE_CHANGED,
|
|
VIDEO_MUTED_CHANGED
|
|
} from './actionTypes';
|
|
import { CAMERA_FACING_MODE } from './constants';
|
|
import './middleware';
|
|
import './reducer';
|
|
|
|
/**
|
|
* Action to signal the change in local audio muted state.
|
|
*
|
|
* @param {boolean} muted - If local audio is muted.
|
|
* @returns {{
|
|
* type: AUDIO_MUTED_CHANGED,
|
|
* muted: boolean
|
|
* }}
|
|
*/
|
|
export function audioMutedChanged(muted) {
|
|
return {
|
|
type: AUDIO_MUTED_CHANGED,
|
|
muted
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Action to signal the change in facing mode of local video camera.
|
|
*
|
|
* @param {CAMERA_FACING_MODE} cameraFacingMode - Camera facing mode.
|
|
* @returns {{
|
|
* type: CAMERA_FACING_MODE_CHANGED,
|
|
* cameraFacingMode: CAMERA_FACING_MODE
|
|
* }}
|
|
*/
|
|
export function cameraFacingModeChanged(cameraFacingMode) {
|
|
return {
|
|
type: CAMERA_FACING_MODE_CHANGED,
|
|
cameraFacingMode
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Toggles the mute state of the local audio track(s).
|
|
*
|
|
* @returns {Function}
|
|
*/
|
|
export function toggleAudioMuted() {
|
|
return (dispatch, getState) => {
|
|
const muted = getState()['features/base/media'].audio.muted;
|
|
|
|
return dispatch(audioMutedChanged(!muted));
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Toggles the camera between front and rear (user and environment).
|
|
*
|
|
* @returns {Function}
|
|
*/
|
|
export function toggleCameraFacingMode() {
|
|
return (dispatch, getState) => {
|
|
let cameraFacingMode
|
|
= getState()['features/base/media'].video.facingMode;
|
|
|
|
cameraFacingMode
|
|
= cameraFacingMode === CAMERA_FACING_MODE.USER
|
|
? CAMERA_FACING_MODE.ENVIRONMENT
|
|
: CAMERA_FACING_MODE.USER;
|
|
|
|
return dispatch(cameraFacingModeChanged(cameraFacingMode));
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Toggles the mute state of the local video track(s).
|
|
*
|
|
* @returns {Function}
|
|
*/
|
|
export function toggleVideoMuted() {
|
|
return (dispatch, getState) => {
|
|
const muted = getState()['features/base/media'].video.muted;
|
|
|
|
return dispatch(videoMutedChanged(!muted));
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Action to signal the change in local video muted state.
|
|
*
|
|
* @param {boolean} muted - If local video is muted.
|
|
* @returns {{
|
|
* type: VIDEO_MUTED_CHANGED,
|
|
* muted: boolean
|
|
* }}
|
|
*/
|
|
export function videoMutedChanged(muted) {
|
|
return {
|
|
type: VIDEO_MUTED_CHANGED,
|
|
muted
|
|
};
|
|
}
|