|
@@ -0,0 +1,39 @@
|
|
1
|
+/* @flow */
|
|
2
|
+
|
|
3
|
+import { CONFERENCE_WILL_JOIN } from '../base/conference';
|
|
4
|
+import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
|
|
5
|
+import { MiddlewareRegistry } from '../base/redux';
|
|
6
|
+
|
|
7
|
+import { updateRecordingSessionData } from './actions';
|
|
8
|
+
|
|
9
|
+/**
|
|
10
|
+ * The redux middleware to handle the recorder updates in a React way.
|
|
11
|
+ *
|
|
12
|
+ * @param {Store} store - The redux store.
|
|
13
|
+ * @returns {Function}
|
|
14
|
+ */
|
|
15
|
+MiddlewareRegistry.register(({ dispatch }) => next => action => {
|
|
16
|
+ const result = next(action);
|
|
17
|
+
|
|
18
|
+ switch (action.type) {
|
|
19
|
+ case CONFERENCE_WILL_JOIN: {
|
|
20
|
+ const { conference } = action;
|
|
21
|
+
|
|
22
|
+ conference.on(
|
|
23
|
+ JitsiConferenceEvents.RECORDER_STATE_CHANGED,
|
|
24
|
+ recorderSession => {
|
|
25
|
+
|
|
26
|
+ if (recorderSession && recorderSession.getID()) {
|
|
27
|
+ dispatch(
|
|
28
|
+ updateRecordingSessionData(recorderSession));
|
|
29
|
+
|
|
30
|
+ return;
|
|
31
|
+ }
|
|
32
|
+ });
|
|
33
|
+
|
|
34
|
+ break;
|
|
35
|
+ }
|
|
36
|
+ }
|
|
37
|
+
|
|
38
|
+ return result;
|
|
39
|
+});
|