Coding style
This commit is contained in:
parent
f62288ae17
commit
41c6759a23
|
@ -1,5 +1,46 @@
|
||||||
|
/* @flow */
|
||||||
|
|
||||||
import { VIDEO_MUTISM_AUTHORITY } from './constants';
|
import { VIDEO_MUTISM_AUTHORITY } from './constants';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether video is currently muted by the audio-only authority.
|
||||||
|
*
|
||||||
|
* @param {Store} store - The redux store.
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export function isVideoMutedByAudioOnly(store: { getState: Function }) {
|
||||||
|
return _isVideoMutedByAuthority(store, VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether video is currently muted by a specific
|
||||||
|
* <tt>VIDEO_MUTISM_AUTHORITY</tt>.
|
||||||
|
*
|
||||||
|
* @param {Store} store - The redux store.
|
||||||
|
* @param {number} videoMutismAuthority - The <tt>VIDEO_MUTISM_AUTHORITY</tt>
|
||||||
|
* which is to be checked whether it has muted video.
|
||||||
|
* @returns {boolean} If video is currently muted by the specified
|
||||||
|
* <tt>videoMutismAuthority</tt>, then <tt>true</tt>; otherwise, <tt>false</tt>.
|
||||||
|
*/
|
||||||
|
function _isVideoMutedByAuthority(
|
||||||
|
{ getState }: { getState: Function },
|
||||||
|
videoMutismAuthority: number) {
|
||||||
|
return Boolean(
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-bitwise
|
||||||
|
getState()['features/base/media'].video.muted & videoMutismAuthority);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether video is currently muted by the user authority.
|
||||||
|
*
|
||||||
|
* @param {Store} store - The redux store.
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export function isVideoMutedByUser(store: { getState: Function }) {
|
||||||
|
return _isVideoMutedByAuthority(store, VIDEO_MUTISM_AUTHORITY.USER);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether a specific videoTrack should be rendered.
|
* Determines whether a specific videoTrack should be rendered.
|
||||||
*
|
*
|
||||||
|
@ -10,33 +51,11 @@ import { VIDEO_MUTISM_AUTHORITY } from './constants';
|
||||||
* @returns {boolean} True if the specified videoTrack should be renderd;
|
* @returns {boolean} True if the specified videoTrack should be renderd;
|
||||||
* otherwise, false.
|
* otherwise, false.
|
||||||
*/
|
*/
|
||||||
export function shouldRenderVideoTrack(videoTrack, waitForVideoStarted) {
|
export function shouldRenderVideoTrack(
|
||||||
|
videoTrack: { muted: boolean, videoStarted: boolean },
|
||||||
|
waitForVideoStarted: boolean) {
|
||||||
return (
|
return (
|
||||||
videoTrack
|
videoTrack
|
||||||
&& !videoTrack.muted
|
&& !videoTrack.muted
|
||||||
&& (!waitForVideoStarted || videoTrack.videoStarted));
|
&& (!waitForVideoStarted || videoTrack.videoStarted));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if video is currently muted by the audio-only authority.
|
|
||||||
*
|
|
||||||
* @param {Object} store - The redux store instance.
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
export function isVideoMutedByAudioOnly({ getState }) {
|
|
||||||
return Boolean(
|
|
||||||
getState()['features/base/media'] // eslint-disable-line no-bitwise
|
|
||||||
.video.muted & VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if video is currently muted by the user authority.
|
|
||||||
*
|
|
||||||
* @param {Object} store - The redux store instance.
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
export function isVideoMutedByUser({ getState }) {
|
|
||||||
return Boolean(
|
|
||||||
getState()['features/base/media'] // eslint-disable-line no-bitwise
|
|
||||||
.video.muted & VIDEO_MUTISM_AUTHORITY.USER);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue