Comply w/ coding style

This commit is contained in:
Lyubomir Marinov 2017-01-17 08:32:20 -06:00
parent 71c04936af
commit 4f8b7a934c
5 changed files with 55 additions and 65 deletions

View File

@ -1,7 +1,7 @@
import { Symbol } from '../react'; import { Symbol } from '../react';
/** /**
* Action to change the muted state of the local audio. * Action to set the muted state of the local audio.
* *
* { * {
* type: SET_AUDIO_MUTED, * type: SET_AUDIO_MUTED,
@ -11,7 +11,7 @@ import { Symbol } from '../react';
export const SET_AUDIO_MUTED = Symbol('SET_AUDIO_MUTED'); export const SET_AUDIO_MUTED = Symbol('SET_AUDIO_MUTED');
/** /**
* Action to change the facing mode of the local video camera. * Action to set the facing mode of the local video camera.
* *
* { * {
* type: SET_CAMERA_FACING_MODE, * type: SET_CAMERA_FACING_MODE,
@ -21,7 +21,7 @@ export const SET_AUDIO_MUTED = Symbol('SET_AUDIO_MUTED');
export const SET_CAMERA_FACING_MODE = Symbol('SET_CAMERA_FACING_MODE'); export const SET_CAMERA_FACING_MODE = Symbol('SET_CAMERA_FACING_MODE');
/** /**
* Action to change the muted state of the local video. * Action to set the muted state of the local video.
* *
* { * {
* type: SET_VIDEO_MUTED, * type: SET_VIDEO_MUTED,

View File

@ -8,9 +8,10 @@ import './middleware';
import './reducer'; import './reducer';
/** /**
* Action to change the local audio muted state. * Action to set the muted state of the local audio.
* *
* @param {boolean} muted - If local audio is muted. * @param {boolean} muted - True if the local audio is to be muted or false if
* the local audio is to be unmuted.
* @returns {{ * @returns {{
* type: SET_AUDIO_MUTED, * type: SET_AUDIO_MUTED,
* muted: boolean * muted: boolean
@ -24,9 +25,9 @@ export function setAudioMuted(muted) {
} }
/** /**
* Action to change the facing mode of the local video camera. * Action to set the facing mode of the local camera.
* *
* @param {CAMERA_FACING_MODE} cameraFacingMode - Camera facing mode. * @param {CAMERA_FACING_MODE} cameraFacingMode - The camera facing mode to set.
* @returns {{ * @returns {{
* type: SET_CAMERA_FACING_MODE, * type: SET_CAMERA_FACING_MODE,
* cameraFacingMode: CAMERA_FACING_MODE * cameraFacingMode: CAMERA_FACING_MODE
@ -39,6 +40,23 @@ export function setCameraFacingMode(cameraFacingMode) {
}; };
} }
/**
* Action to set the muted state of the local video.
*
* @param {boolean} muted - True if the local video is to be muted or false if
* the local video is to be unmuted.
* @returns {{
* type: SET_VIDEO_MUTED,
* muted: boolean
* }}
*/
export function setVideoMuted(muted) {
return {
type: SET_VIDEO_MUTED,
muted
};
}
/** /**
* Toggles the mute state of the local audio track(s). * Toggles the mute state of the local audio track(s).
* *
@ -83,19 +101,3 @@ export function toggleVideoMuted() {
return dispatch(setVideoMuted(!muted)); return dispatch(setVideoMuted(!muted));
}; };
} }
/**
* Action to change the local video muted state.
*
* @param {boolean} muted - If local video is muted.
* @returns {{
* type: SET_VIDEO_MUTED,
* muted: boolean
* }}
*/
export function setVideoMuted(muted) {
return {
type: SET_VIDEO_MUTED,
muted
};
}

View File

@ -9,6 +9,21 @@ import {
} from './actionTypes'; } from './actionTypes';
import { CAMERA_FACING_MODE } from './constants'; import { CAMERA_FACING_MODE } from './constants';
/**
* Listen for various actions related to media devices.
*
* @param {Object} state - State of media devices.
* @param {Object} action - Action object.
* @param {string} action.type - Type of action.
* @param {Object} action.media - Information about media devices to be
* modified.
* @returns {Object}
*/
ReducerRegistry.register('features/base/media', combineReducers({
audio,
video
}));
/** /**
* Media state object for local audio. * Media state object for local audio.
* *
@ -90,18 +105,3 @@ function video(state = VIDEO_INITIAL_MEDIA_STATE, action) {
return state; return state;
} }
} }
/**
* Listen for various actions related to media devices.
*
* @param {Object} state - State of media devices.
* @param {Object} action - Action object.
* @param {string} action.type - Type of action.
* @param {Object} action.media - Information about media devices to be
* modified.
* @returns {Object}
*/
ReducerRegistry.register('features/base/media', combineReducers({
audio,
video
}));

View File

@ -1,7 +1,4 @@
import { import { LIB_DISPOSED, LIB_INITIALIZED } from '../lib-jitsi-meet';
LIB_DISPOSED,
LIB_INITIALIZED
} from '../lib-jitsi-meet';
import { import {
MEDIA_TYPE, MEDIA_TYPE,
SET_AUDIO_MUTED, SET_AUDIO_MUTED,
@ -12,15 +9,9 @@ import {
} from '../media'; } from '../media';
import { MiddlewareRegistry } from '../redux'; import { MiddlewareRegistry } from '../redux';
import { import { createLocalTracks, destroyLocalTracks } from './actions';
createLocalTracks,
destroyLocalTracks
} from './actions';
import { TRACK_UPDATED } from './actionTypes'; import { TRACK_UPDATED } from './actionTypes';
import { import { getLocalTrack, setTrackMuted } from './functions';
getLocalTrack,
setTrackMuted
} from './functions';
/** /**
* Middleware that captures LIB_INITIALIZED and LIB_DISPOSED actions * Middleware that captures LIB_INITIALIZED and LIB_DISPOSED actions
@ -32,6 +23,14 @@ import {
*/ */
MiddlewareRegistry.register(store => next => action => { MiddlewareRegistry.register(store => next => action => {
switch (action.type) { switch (action.type) {
case LIB_INITIALIZED:
store.dispatch(createLocalTracks());
break;
case LIB_DISPOSED:
store.dispatch(destroyLocalTracks());
break;
case SET_AUDIO_MUTED: case SET_AUDIO_MUTED:
_setMuted(store, action, MEDIA_TYPE.AUDIO); _setMuted(store, action, MEDIA_TYPE.AUDIO);
break; break;
@ -45,20 +44,12 @@ MiddlewareRegistry.register(store => next => action => {
); );
break; break;
case LIB_INITIALIZED: case SET_VIDEO_MUTED:
store.dispatch(createLocalTracks()); _setMuted(store, action, MEDIA_TYPE.VIDEO);
break;
case LIB_DISPOSED:
store.dispatch(destroyLocalTracks());
break; break;
case TRACK_UPDATED: case TRACK_UPDATED:
return _trackUpdated(store, next, action); return _trackUpdated(store, next, action);
case SET_VIDEO_MUTED:
_setMuted(store, action, MEDIA_TYPE.VIDEO);
break;
} }
return next(action); return next(action);

View File

@ -1,8 +1,5 @@
import { _handleParticipantError } from '../base/conference'; import { _handleParticipantError } from '../base/conference';
import { import { MEDIA_TYPE, VIDEO_TYPE } from '../base/media';
MEDIA_TYPE,
VIDEO_TYPE
} from '../base/media';
import { import {
getLocalVideoTrack, getLocalVideoTrack,
getTrackByMediaTypeAndParticipant getTrackByMediaTypeAndParticipant
@ -48,7 +45,7 @@ export function selectParticipant() {
/** /**
* Action to select the participant to be displayed in LargeVideo based on a * Action to select the participant to be displayed in LargeVideo based on a
* variety of factors: if there is a dominant or pinned speaker, or if there are * variety of factors: if there is a dominant or pinned speaker, or if there are
* remote tracks etc. * remote tracks, etc.
* *
* @returns {Function} * @returns {Function}
*/ */