Skip to content

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

Comply w/ coding style

Lyubo Marinov165294bfb13b
diff --git a/react/features/background/actionTypes.js b/react/features/background/actionTypes.js
index 7f7323e0a3..142c82460a 100644
--- a/react/features/background/actionTypes.js
+++ b/react/features/background/actionTypes.js
@@ -10,8 +10,7 @@ import { Symbol } from '../base/react';
*
* @protected
*/
-export const _SET_APP_STATE_LISTENER
- = Symbol('_SET_APP_STATE_LISTENER');
+export const _SET_APP_STATE_LISTENER = Symbol('_SET_APP_STATE_LISTENER');
/**
* The type of redux action which signals that video will be muted because the
@@ -28,8 +27,7 @@ export const _SET_BACKGROUND_VIDEO_MUTED
= Symbol('_SET_BACKGROUND_VIDEO_MUTED');
/**
- * The type of redux action which signals that the video channel's lastN value
- * must be changed.
+ * The type of redux action which sets the video channel's lastN (value).
*
* {
* type: _SET_LASTN,
@@ -38,9 +36,7 @@ export const _SET_BACKGROUND_VIDEO_MUTED
*
* @protected
*/
-export const _SET_LASTN
- = Symbol('_SET_LASTN');
-
+export const _SET_LASTN = Symbol('_SET_LASTN');
/**
* The type of redux action which signals that the app state has changed (in
diff --git a/react/features/background/actions.js b/react/features/background/actions.js
index 4723fed46c..f787422bd6 100644
--- a/react/features/background/actions.js
+++ b/react/features/background/actions.js
@@ -7,25 +7,6 @@ import {
APP_STATE_CHANGED
} from './actionTypes';
-/**
- * Signals that the App state has changed (in terms of execution state). The
- * application can be in 3 states: 'active', 'inactive' and 'background'.
- *
- * @param {string} appState - The new App state.
- * @public
- * @returns {{
- * type: APP_STATE_CHANGED,
- * appState: string
- * }}
- * @see {@link https://facebook.github.io/react-native/docs/appstate.html}
- */
-export function appStateChanged(appState: string) {
- return {
- type: APP_STATE_CHANGED,
- appState
- };
-}
-
/**
* Sets the listener to be used with React Native's AppState API.
*
@@ -61,21 +42,29 @@ export function _setBackgroundVideoMuted(muted: boolean) {
const { audioOnly } = getState()['features/base/conference'];
if (!audioOnly) {
- const { config } = getState()['features/base/lib-jitsi-meet'];
- const defaultLastN
- = typeof config.channelLastN === 'undefined'
- ? -1 : config.channelLastN;
+ let lastN;
+
+ if (muted) {
+ lastN = 0;
+ } else {
+ const { config } = getState()['features/base/lib-jitsi-meet'];
+
+ lastN = config.channelLastN;
+ if (typeof lastN === 'undefined') {
+ lastN = -1;
+ }
+ }
dispatch({
type: _SET_LASTN,
- lastN: muted ? 0 : defaultLastN
+ lastN
});
}
if (muted) {
- const mediaState = getState()['features/base/media'];
+ const { video } = getState()['features/base/media'];
- if (mediaState.video.muted) {
+ if (video.muted) {
// Video is already muted, do nothing.
return;
}
@@ -97,3 +86,22 @@ export function _setBackgroundVideoMuted(muted: boolean) {
dispatch(setVideoMuted(muted));
};
}
+
+/**
+ * Signals that the App state has changed (in terms of execution state). The
+ * application can be in 3 states: 'active', 'inactive' and 'background'.
+ *
+ * @param {string} appState - The new App state.
+ * @public
+ * @returns {{
+ * type: APP_STATE_CHANGED,
+ * appState: string
+ * }}
+ * @see {@link https://facebook.github.io/react-native/docs/appstate.html}
+ */
+export function appStateChanged(appState: string) {
+ return {
+ type: APP_STATE_CHANGED,
+ appState
+ };
+}
diff --git a/react/features/background/middleware.js b/react/features/background/middleware.js
index 19726a3d3d..a96dac3586 100644
--- a/react/features/background/middleware.js
+++ b/react/features/background/middleware.js
@@ -54,7 +54,7 @@ MiddlewareRegistry.register(store => next => action => {
try {
conference.setLastN(action.lastN);
} catch (err) {
- console.warn(`Error setting lastN: ${err}`);
+ console.warn(`Failed to set lastN: ${err}`);
}
}