|
@@ -17,21 +17,23 @@ import { createLocalTracksF } from './functions';
|
17
|
17
|
|
18
|
18
|
/**
|
19
|
19
|
* Requests the creating of the desired media type tracks. Desire is expressed
|
20
|
|
- * by base/media. This function will dispatch a {@code createLocalTracksA}
|
21
|
|
- * action for the "missing" types, that is, the ones which base/media would
|
22
|
|
- * like to have (unmuted tracks) but are not present yet.
|
|
20
|
+ * by base/media unless the function caller specifies desired media types
|
|
21
|
+ * explicitly and thus override base/media. Dispatches a
|
|
22
|
+ * {@code createLocalTracksA} action for the desired media types for which there
|
|
23
|
+ * are no existing tracks yet.
|
23
|
24
|
*
|
24
|
25
|
* @returns {Function}
|
25
|
26
|
*/
|
26
|
|
-export function createDesiredLocalTracks() {
|
|
27
|
+export function createDesiredLocalTracks(...desiredTypes) {
|
27
|
28
|
return (dispatch, getState) => {
|
28
|
29
|
const state = getState();
|
29
|
|
- const desiredTypes = [];
|
30
|
30
|
|
31
|
|
- state['features/base/media'].audio.muted
|
32
|
|
- || desiredTypes.push(MEDIA_TYPE.AUDIO);
|
33
|
|
- Boolean(state['features/base/media'].video.muted)
|
34
|
|
- || desiredTypes.push(MEDIA_TYPE.VIDEO);
|
|
31
|
+ if (desiredTypes.length === 0) {
|
|
32
|
+ const { audio, video } = state['features/base/media'];
|
|
33
|
+
|
|
34
|
+ audio.muted || desiredTypes.push(MEDIA_TYPE.AUDIO);
|
|
35
|
+ Boolean(video.muted) || desiredTypes.push(MEDIA_TYPE.VIDEO);
|
|
36
|
+ }
|
35
|
37
|
|
36
|
38
|
const availableTypes
|
37
|
39
|
= state['features/base/tracks']
|