|
@@ -124,68 +124,6 @@ function connect(roomName) {
|
124
|
124
|
});
|
125
|
125
|
}
|
126
|
126
|
|
127
|
|
-/**
|
128
|
|
- * Creates local media tracks and connects to room. Will show error
|
129
|
|
- * dialogs in case if accessing local microphone and/or camera failed. Will
|
130
|
|
- * show guidance overlay for users on how to give access to camera and/or
|
131
|
|
- * microphone,
|
132
|
|
- * @param {string} roomName
|
133
|
|
- * @returns {Promise.<JitsiLocalTrack[], JitsiConnection>}
|
134
|
|
- */
|
135
|
|
-function createInitialLocalTracksAndConnect(roomName) {
|
136
|
|
- let audioAndVideoError,
|
137
|
|
- audioOnlyError,
|
138
|
|
- videoOnlyError;
|
139
|
|
-
|
140
|
|
- JitsiMeetJS.mediaDevices.addEventListener(
|
141
|
|
- JitsiMeetJS.events.mediaDevices.PERMISSION_PROMPT_IS_SHOWN,
|
142
|
|
- browser =>
|
143
|
|
- APP.store.dispatch(
|
144
|
|
- mediaPermissionPromptVisibilityChanged(true, browser))
|
145
|
|
- );
|
146
|
|
-
|
147
|
|
- // First try to retrieve both audio and video.
|
148
|
|
- let tryCreateLocalTracks = createLocalTracks(
|
149
|
|
- { devices: ['audio', 'video'] }, true)
|
150
|
|
- .catch(err => {
|
151
|
|
- // If failed then try to retrieve only audio.
|
152
|
|
- audioAndVideoError = err;
|
153
|
|
- return createLocalTracks({ devices: ['audio'] }, true);
|
154
|
|
- })
|
155
|
|
- .catch(err => {
|
156
|
|
- audioOnlyError = err;
|
157
|
|
-
|
158
|
|
- // Try video only...
|
159
|
|
- return createLocalTracks({ devices: ['video'] }, true);
|
160
|
|
- })
|
161
|
|
- .catch(err => {
|
162
|
|
- videoOnlyError = err;
|
163
|
|
-
|
164
|
|
- return [];
|
165
|
|
- });
|
166
|
|
-
|
167
|
|
- return Promise.all([ tryCreateLocalTracks, connect(roomName) ])
|
168
|
|
- .then(([tracks, con]) => {
|
169
|
|
- APP.store.dispatch(mediaPermissionPromptVisibilityChanged(false));
|
170
|
|
- if (audioAndVideoError) {
|
171
|
|
- if (audioOnlyError) {
|
172
|
|
- // If both requests for 'audio' + 'video' and 'audio' only
|
173
|
|
- // failed, we assume that there is some problems with user's
|
174
|
|
- // microphone and show corresponding dialog.
|
175
|
|
- APP.UI.showDeviceErrorDialog(
|
176
|
|
- audioOnlyError, videoOnlyError);
|
177
|
|
- } else {
|
178
|
|
- // If request for 'audio' + 'video' failed, but request for
|
179
|
|
- // 'audio' only was OK, we assume that we had problems with
|
180
|
|
- // camera and show corresponding dialog.
|
181
|
|
- APP.UI.showDeviceErrorDialog(null, audioAndVideoError);
|
182
|
|
- }
|
183
|
|
- }
|
184
|
|
-
|
185
|
|
- return [tracks, con];
|
186
|
|
- });
|
187
|
|
-}
|
188
|
|
-
|
189
|
127
|
/**
|
190
|
128
|
* Share data to other users.
|
191
|
129
|
* @param command the command
|
|
@@ -553,6 +491,70 @@ export default {
|
553
|
491
|
* Whether the local participant is the dominant speaker in the conference.
|
554
|
492
|
*/
|
555
|
493
|
isDominantSpeaker: false,
|
|
494
|
+
|
|
495
|
+ /**
|
|
496
|
+ * Creates local media tracks and connects to a room. Will show error
|
|
497
|
+ * dialogs in case accessing the local microphone and/or camera failed. Will
|
|
498
|
+ * show guidance overlay for users on how to give access to camera and/or
|
|
499
|
+ * microphone,
|
|
500
|
+ * @param {string} roomName
|
|
501
|
+ * @returns {Promise.<JitsiLocalTrack[], JitsiConnection>}
|
|
502
|
+ */
|
|
503
|
+ createInitialLocalTracksAndConnect(roomName) {
|
|
504
|
+ let audioAndVideoError,
|
|
505
|
+ audioOnlyError,
|
|
506
|
+ videoOnlyError;
|
|
507
|
+
|
|
508
|
+ JitsiMeetJS.mediaDevices.addEventListener(
|
|
509
|
+ JitsiMeetJS.events.mediaDevices.PERMISSION_PROMPT_IS_SHOWN,
|
|
510
|
+ browser =>
|
|
511
|
+ APP.store.dispatch(
|
|
512
|
+ mediaPermissionPromptVisibilityChanged(true, browser))
|
|
513
|
+ );
|
|
514
|
+
|
|
515
|
+ // First try to retrieve both audio and video.
|
|
516
|
+ let tryCreateLocalTracks = createLocalTracks(
|
|
517
|
+ { devices: ['audio', 'video'] }, true)
|
|
518
|
+ .catch(err => {
|
|
519
|
+ // If failed then try to retrieve only audio.
|
|
520
|
+ audioAndVideoError = err;
|
|
521
|
+ return createLocalTracks({ devices: ['audio'] }, true);
|
|
522
|
+ })
|
|
523
|
+ .catch(err => {
|
|
524
|
+ audioOnlyError = err;
|
|
525
|
+
|
|
526
|
+ // Try video only...
|
|
527
|
+ return createLocalTracks({ devices: ['video'] }, true);
|
|
528
|
+ })
|
|
529
|
+ .catch(err => {
|
|
530
|
+ videoOnlyError = err;
|
|
531
|
+
|
|
532
|
+ return [];
|
|
533
|
+ });
|
|
534
|
+
|
|
535
|
+ return Promise.all([ tryCreateLocalTracks, connect(roomName) ])
|
|
536
|
+ .then(([tracks, con]) => {
|
|
537
|
+ APP.store.dispatch(
|
|
538
|
+ mediaPermissionPromptVisibilityChanged(false));
|
|
539
|
+ if (audioAndVideoError) {
|
|
540
|
+ if (audioOnlyError) {
|
|
541
|
+ // If both requests for 'audio' + 'video' and 'audio'
|
|
542
|
+ // only failed, we assume that there is some problems
|
|
543
|
+ // with user's microphone and show corresponding dialog.
|
|
544
|
+ APP.UI.showDeviceErrorDialog(
|
|
545
|
+ audioOnlyError, videoOnlyError);
|
|
546
|
+ } else {
|
|
547
|
+ // If request for 'audio' + 'video' failed, but request
|
|
548
|
+ // for 'audio' only was OK, we assume that we had
|
|
549
|
+ // problems with camera and show corresponding dialog.
|
|
550
|
+ APP.UI.showDeviceErrorDialog(null, audioAndVideoError);
|
|
551
|
+ }
|
|
552
|
+ }
|
|
553
|
+
|
|
554
|
+ return [tracks, con];
|
|
555
|
+ });
|
|
556
|
+ },
|
|
557
|
+
|
556
|
558
|
/**
|
557
|
559
|
* Open new connection and join to the conference.
|
558
|
560
|
* @param {object} options
|
|
@@ -588,7 +590,8 @@ export default {
|
588
|
590
|
{enableAnalyticsLogging: analytics.isEnabled()}, config)
|
589
|
591
|
).then(() => {
|
590
|
592
|
analytics.init();
|
591
|
|
- return createInitialLocalTracksAndConnect(options.roomName);
|
|
593
|
+ return this.createInitialLocalTracksAndConnect(
|
|
594
|
+ options.roomName);
|
592
|
595
|
}).then(([tracks, con]) => {
|
593
|
596
|
tracks.forEach(track => {
|
594
|
597
|
if((track.isAudioTrack() && initialAudioMutedState)
|