Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Coding style

Lyubo Marinov41c6759a2350
diff --git a/react/features/base/media/functions.js b/react/features/base/media/functions.js
index f4064ee18a..f254a74b95 100644
--- a/react/features/base/media/functions.js
+++ b/react/features/base/media/functions.js
@@ -1,42 +1,61 @@
+/* @flow */
+
import { VIDEO_MUTISM_AUTHORITY } from './constants';
/**
- * Determines whether a specific videoTrack should be rendered.
+ * Determines whether video is currently muted by the audio-only authority.
*
- * @param {Track} videoTrack - The video track which is to be rendered.
- * @param {boolean} waitForVideoStarted - True if the specified videoTrack
- * should be rendered only after its associated video has started;
- * otherwise, false.
- * @returns {boolean} True if the specified videoTrack should be renderd;
- * otherwise, false.
+ * @param {Store} store - The redux store.
+ * @returns {boolean}
*/
-export function shouldRenderVideoTrack(videoTrack, waitForVideoStarted) {
- return (
- videoTrack
- && !videoTrack.muted
- && (!waitForVideoStarted || videoTrack.videoStarted));
+export function isVideoMutedByAudioOnly(store: { getState: Function }) {
+ return _isVideoMutedByAuthority(store, VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY);
}
/**
- * Checks if video is currently muted by the audio-only authority.
+ * Determines whether video is currently muted by a specific
+ * <tt>VIDEO_MUTISM_AUTHORITY</tt>.
*
- * @param {Object} store - The redux store instance.
- * @returns {boolean}
+ * @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>.
*/
-export function isVideoMutedByAudioOnly({ getState }) {
+function _isVideoMutedByAuthority(
+ { getState }: { getState: Function },
+ videoMutismAuthority: number) {
return Boolean(
- getState()['features/base/media'] // eslint-disable-line no-bitwise
- .video.muted & VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY);
+
+ // eslint-disable-next-line no-bitwise
+ getState()['features/base/media'].video.muted & videoMutismAuthority);
}
/**
- * Checks if video is currently muted by the user authority.
+ * Determines whether video is currently muted by the user authority.
*
- * @param {Object} store - The redux store instance.
+ * @param {Store} store - The redux store.
* @returns {boolean}
*/
-export function isVideoMutedByUser({ getState }) {
- return Boolean(
- getState()['features/base/media'] // eslint-disable-line no-bitwise
- .video.muted & VIDEO_MUTISM_AUTHORITY.USER);
+export function isVideoMutedByUser(store: { getState: Function }) {
+ return _isVideoMutedByAuthority(store, VIDEO_MUTISM_AUTHORITY.USER);
+}
+
+/**
+ * Determines whether a specific videoTrack should be rendered.
+ *
+ * @param {Track} videoTrack - The video track which is to be rendered.
+ * @param {boolean} waitForVideoStarted - True if the specified videoTrack
+ * should be rendered only after its associated video has started;
+ * otherwise, false.
+ * @returns {boolean} True if the specified videoTrack should be renderd;
+ * otherwise, false.
+ */
+export function shouldRenderVideoTrack(
+ videoTrack: { muted: boolean, videoStarted: boolean },
+ waitForVideoStarted: boolean) {
+ return (
+ videoTrack
+ && !videoTrack.muted
+ && (!waitForVideoStarted || videoTrack.videoStarted));
}