|
@@ -1,7 +1,7 @@
|
1
|
1
|
import { combineReducers } from 'redux';
|
2
|
2
|
|
3
|
3
|
import { CONFERENCE_FAILED, CONFERENCE_LEFT } from '../conference/actionTypes';
|
4
|
|
-import { ReducerRegistry } from '../redux';
|
|
4
|
+import ReducerRegistry from '../redux/ReducerRegistry';
|
5
|
5
|
import { TRACK_REMOVED } from '../tracks/actionTypes';
|
6
|
6
|
|
7
|
7
|
import {
|
|
@@ -49,7 +49,7 @@ export const _AUDIO_INITIAL_MEDIA_STATE = {
|
49
|
49
|
* @private
|
50
|
50
|
* @returns {AudioMediaState}
|
51
|
51
|
*/
|
52
|
|
-function _audio(state = _AUDIO_INITIAL_MEDIA_STATE, action) {
|
|
52
|
+function _audio(state: IAudioState = _AUDIO_INITIAL_MEDIA_STATE, action: any) {
|
53
|
53
|
switch (action.type) {
|
54
|
54
|
case SET_AUDIO_AVAILABLE:
|
55
|
55
|
return {
|
|
@@ -103,7 +103,7 @@ export const _SCREENSHARE_INITIAL_MEDIA_STATE = {
|
103
|
103
|
* @private
|
104
|
104
|
* @returns {ScreenshareMediaState}
|
105
|
105
|
*/
|
106
|
|
-function _screenshare(state = _SCREENSHARE_INITIAL_MEDIA_STATE, action) {
|
|
106
|
+function _screenshare(state: IScreenshareState = _SCREENSHARE_INITIAL_MEDIA_STATE, action: any) {
|
107
|
107
|
switch (action.type) {
|
108
|
108
|
case SET_SCREENSHARE_MUTED:
|
109
|
109
|
return {
|
|
@@ -161,7 +161,7 @@ export const _VIDEO_INITIAL_MEDIA_STATE = {
|
161
|
161
|
* @private
|
162
|
162
|
* @returns {VideoMediaState}
|
163
|
163
|
*/
|
164
|
|
-function _video(state = _VIDEO_INITIAL_MEDIA_STATE, action) {
|
|
164
|
+function _video(state: IVideoState = _VIDEO_INITIAL_MEDIA_STATE, action: any) {
|
165
|
165
|
switch (action.type) {
|
166
|
166
|
case CONFERENCE_FAILED:
|
167
|
167
|
case CONFERENCE_LEFT:
|
|
@@ -216,6 +216,32 @@ function _video(state = _VIDEO_INITIAL_MEDIA_STATE, action) {
|
216
|
216
|
}
|
217
|
217
|
}
|
218
|
218
|
|
|
219
|
+interface IAudioState {
|
|
220
|
+ available: boolean;
|
|
221
|
+ muted: boolean;
|
|
222
|
+ unmuteBlocked: boolean;
|
|
223
|
+}
|
|
224
|
+
|
|
225
|
+interface IScreenshareState {
|
|
226
|
+ available: boolean;
|
|
227
|
+ muted: number;
|
|
228
|
+ unmuteBlocked: boolean;
|
|
229
|
+}
|
|
230
|
+
|
|
231
|
+interface IVideoState {
|
|
232
|
+ available: boolean;
|
|
233
|
+ facingMode: string;
|
|
234
|
+ muted: number;
|
|
235
|
+ transforms: Object;
|
|
236
|
+ unmuteBlocked: boolean;
|
|
237
|
+}
|
|
238
|
+
|
|
239
|
+export interface IMediaState {
|
|
240
|
+ audio: IAudioState;
|
|
241
|
+ screenshare: IScreenshareState;
|
|
242
|
+ video: IVideoState;
|
|
243
|
+}
|
|
244
|
+
|
219
|
245
|
/**
|
220
|
246
|
* Listen for various actions related to media devices.
|
221
|
247
|
*
|
|
@@ -239,7 +265,7 @@ ReducerRegistry.register('features/base/media', combineReducers({
|
239
|
265
|
* @private
|
240
|
266
|
* @returns {Object}
|
241
|
267
|
*/
|
242
|
|
-function _clearAllVideoTransforms(state) {
|
|
268
|
+function _clearAllVideoTransforms(state: IVideoState) {
|
243
|
269
|
return {
|
244
|
270
|
...state,
|
245
|
271
|
transforms: _VIDEO_INITIAL_MEDIA_STATE.transforms
|
|
@@ -254,7 +280,7 @@ function _clearAllVideoTransforms(state) {
|
254
|
280
|
* @private
|
255
|
281
|
* @returns {Object}
|
256
|
282
|
*/
|
257
|
|
-function _storeVideoTransform(state, { streamId, transform }) {
|
|
283
|
+function _storeVideoTransform(state: IVideoState, { streamId, transform }: { streamId: string, transform: string }) {
|
258
|
284
|
return {
|
259
|
285
|
...state,
|
260
|
286
|
transforms: {
|
|
@@ -273,12 +299,12 @@ function _storeVideoTransform(state, { streamId, transform }) {
|
273
|
299
|
* @private
|
274
|
300
|
* @returns {Object}
|
275
|
301
|
*/
|
276
|
|
-function _trackRemoved(state, { track: { jitsiTrack } }) {
|
|
302
|
+function _trackRemoved(state: IVideoState, { track: { jitsiTrack } } : {track: {jitsiTrack: any}}) {
|
277
|
303
|
if (jitsiTrack) {
|
278
|
304
|
const streamId = jitsiTrack.getStreamId();
|
279
|
305
|
|
280
|
306
|
if (streamId && streamId in state.transforms) {
|
281
|
|
- const nextTransforms = {
|
|
307
|
+ const nextTransforms: any = {
|
282
|
308
|
...state.transforms
|
283
|
309
|
};
|
284
|
310
|
|