浏览代码

Coding style

master
Lyubo Marinov 8 年前
父节点
当前提交
41c6759a23
共有 1 个文件被更改,包括 43 次插入24 次删除
  1. 43
    24
      react/features/base/media/functions.js

+ 43
- 24
react/features/base/media/functions.js 查看文件

1
+/* @flow */
2
+
1
 import { VIDEO_MUTISM_AUTHORITY } from './constants';
3
 import { VIDEO_MUTISM_AUTHORITY } from './constants';
2
 
4
 
3
 /**
5
 /**
4
- * Determines whether a specific videoTrack should be rendered.
6
+ * Determines whether video is currently muted by the audio-only authority.
5
  *
7
  *
6
- * @param {Track} videoTrack - The video track which is to be rendered.
7
- * @param {boolean} waitForVideoStarted - True if the specified videoTrack
8
- * should be rendered only after its associated video has started;
9
- * otherwise, false.
10
- * @returns {boolean} True if the specified videoTrack should be renderd;
11
- * otherwise, false.
8
+ * @param {Store} store - The redux store.
9
+ * @returns {boolean}
12
  */
10
  */
13
-export function shouldRenderVideoTrack(videoTrack, waitForVideoStarted) {
14
-    return (
15
-        videoTrack
16
-            && !videoTrack.muted
17
-            && (!waitForVideoStarted || videoTrack.videoStarted));
11
+export function isVideoMutedByAudioOnly(store: { getState: Function }) {
12
+    return _isVideoMutedByAuthority(store, VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY);
18
 }
13
 }
19
 
14
 
20
 /**
15
 /**
21
- * Checks if video is currently muted by the audio-only authority.
16
+ * Determines whether video is currently muted by a specific
17
+ * <tt>VIDEO_MUTISM_AUTHORITY</tt>.
22
  *
18
  *
23
- * @param {Object} store - The redux store instance.
24
- * @returns {boolean}
19
+ * @param {Store} store - The redux store.
20
+ * @param {number} videoMutismAuthority - The <tt>VIDEO_MUTISM_AUTHORITY</tt>
21
+ * which is to be checked whether it has muted video.
22
+ * @returns {boolean} If video is currently muted by the specified
23
+ * <tt>videoMutismAuthority</tt>, then <tt>true</tt>; otherwise, <tt>false</tt>.
25
  */
24
  */
26
-export function isVideoMutedByAudioOnly({ getState }) {
25
+function _isVideoMutedByAuthority(
26
+        { getState }: { getState: Function },
27
+        videoMutismAuthority: number) {
27
     return Boolean(
28
     return Boolean(
28
-        getState()['features/base/media'] // eslint-disable-line no-bitwise
29
-            .video.muted & VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY);
29
+
30
+        // eslint-disable-next-line no-bitwise
31
+        getState()['features/base/media'].video.muted & videoMutismAuthority);
30
 }
32
 }
31
 
33
 
32
 /**
34
 /**
33
- * Checks if video is currently muted by the user authority.
35
+ * Determines whether video is currently muted by the user authority.
34
  *
36
  *
35
- * @param {Object} store - The redux store instance.
37
+ * @param {Store} store - The redux store.
36
  * @returns {boolean}
38
  * @returns {boolean}
37
  */
39
  */
38
-export function isVideoMutedByUser({ getState }) {
39
-    return Boolean(
40
-        getState()['features/base/media'] // eslint-disable-line no-bitwise
41
-            .video.muted & VIDEO_MUTISM_AUTHORITY.USER);
40
+export function isVideoMutedByUser(store: { getState: Function }) {
41
+    return _isVideoMutedByAuthority(store, VIDEO_MUTISM_AUTHORITY.USER);
42
+}
43
+
44
+/**
45
+ * Determines whether a specific videoTrack should be rendered.
46
+ *
47
+ * @param {Track} videoTrack - The video track which is to be rendered.
48
+ * @param {boolean} waitForVideoStarted - True if the specified videoTrack
49
+ * should be rendered only after its associated video has started;
50
+ * otherwise, false.
51
+ * @returns {boolean} True if the specified videoTrack should be renderd;
52
+ * otherwise, false.
53
+ */
54
+export function shouldRenderVideoTrack(
55
+        videoTrack: { muted: boolean, videoStarted: boolean },
56
+        waitForVideoStarted: boolean) {
57
+    return (
58
+        videoTrack
59
+            && !videoTrack.muted
60
+            && (!waitForVideoStarted || videoTrack.videoStarted));
42
 }
61
 }

正在加载...
取消
保存