|
|
@@ -26,6 +26,7 @@ import {
|
|
26
|
26
|
toggleAudioOnly
|
|
27
|
27
|
} from './actions';
|
|
28
|
28
|
import {
|
|
|
29
|
+ CONFERENCE_FAILED,
|
|
29
|
30
|
CONFERENCE_JOINED,
|
|
30
|
31
|
DATA_CHANNEL_OPENED,
|
|
31
|
32
|
SET_AUDIO_ONLY,
|
|
|
@@ -55,6 +56,9 @@ MiddlewareRegistry.register(store => next => action => {
|
|
55
|
56
|
case CONNECTION_ESTABLISHED:
|
|
56
|
57
|
return _connectionEstablished(store, next, action);
|
|
57
|
58
|
|
|
|
59
|
+ case CONFERENCE_FAILED:
|
|
|
60
|
+ return _conferenceFailed(next, action);
|
|
|
61
|
+
|
|
58
|
62
|
case CONFERENCE_JOINED:
|
|
59
|
63
|
return _conferenceJoined(store, next, action);
|
|
60
|
64
|
|
|
|
@@ -109,6 +113,33 @@ function _connectionEstablished({ dispatch }, next, action) {
|
|
109
|
113
|
return result;
|
|
110
|
114
|
}
|
|
111
|
115
|
|
|
|
116
|
+/**
|
|
|
117
|
+ * Makes sure to leave a failed conference in order to release any allocated
|
|
|
118
|
+ * resources like peerconnections, emit participant left events etc.
|
|
|
119
|
+ *
|
|
|
120
|
+ * @param {Dispatch} next - The redux dispatch function to dispatch the
|
|
|
121
|
+ * specified action to the specified store.
|
|
|
122
|
+ * @param {Action} action - The redux action CONFERENCE_FAILED which is being
|
|
|
123
|
+ * dispatched in the specified store.
|
|
|
124
|
+ * @private
|
|
|
125
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
|
|
126
|
+ */
|
|
|
127
|
+function _conferenceFailed(next, action) {
|
|
|
128
|
+ const result = next(action);
|
|
|
129
|
+ const { conference, error } = action;
|
|
|
130
|
+
|
|
|
131
|
+ !error.recoverable
|
|
|
132
|
+ && conference
|
|
|
133
|
+ && conference.leave().catch(leaveError => {
|
|
|
134
|
+ // Even though we don't care too much about the failure it may be
|
|
|
135
|
+ // good to now that it happen, so log it on the info level.
|
|
|
136
|
+ logger.info(
|
|
|
137
|
+ 'There was an error leaving a failed conference: ', leaveError);
|
|
|
138
|
+ });
|
|
|
139
|
+
|
|
|
140
|
+ return result;
|
|
|
141
|
+}
|
|
|
142
|
+
|
|
112
|
143
|
/**
|
|
113
|
144
|
* Does extra sync up on properties that may need to be updated after the
|
|
114
|
145
|
* conference was joined.
|