Bläddra i källkod

[RN] Rename createInitialLocalTracks to createLocalTracks

The name better suits its purpose, since it can be called at any time.
master
Saúl Ibarra Corretgé 7 år sedan
förälder
incheckning
c42f1704ff

+ 22
- 22
conference.js Visa fil

@@ -57,7 +57,7 @@ import {
57 57
     participantUpdated
58 58
 } from './react/features/base/participants';
59 59
 import {
60
-    createLocalTracks,
60
+    createLocalTracksF,
61 61
     isLocalTrackMuted,
62 62
     replaceLocalTrack,
63 63
     trackAdded,
@@ -539,7 +539,7 @@ export default {
539 539
                         return [desktopStream];
540 540
                     }
541 541
 
542
-                    return createLocalTracks({ devices: ['audio'] }, true)
542
+                    return createLocalTracksF({ devices: ['audio'] }, true)
543 543
                         .then(([audioStream]) => {
544 544
                             return [desktopStream, audioStream];
545 545
                         })
@@ -551,7 +551,7 @@ export default {
551 551
                     logger.error('Failed to obtain desktop stream', error);
552 552
                     screenSharingError = error;
553 553
                     return requestedAudio
554
-                        ? createLocalTracks({ devices: ['audio'] }, true)
554
+                        ? createLocalTracksF({ devices: ['audio'] }, true)
555 555
                         : [];
556 556
                 }).catch(error => {
557 557
                     audioOnlyError = error;
@@ -561,7 +561,7 @@ export default {
561 561
             // Resolve with no tracks
562 562
             tryCreateLocalTracks = Promise.resolve([]);
563 563
         } else {
564
-            tryCreateLocalTracks = createLocalTracks(
564
+            tryCreateLocalTracks = createLocalTracksF(
565 565
                 { devices: initialDevices }, true)
566 566
                 .catch(err => {
567 567
                     if (requestedAudio && requestedVideo) {
@@ -569,7 +569,7 @@ export default {
569 569
                         // Try audio only...
570 570
                         audioAndVideoError = err;
571 571
 
572
-                        return createLocalTracks({devices: ['audio']}, true);
572
+                        return createLocalTracksF({devices: ['audio']}, true);
573 573
                     } else if (requestedAudio && !requestedVideo) {
574 574
                         audioOnlyError = err;
575 575
 
@@ -589,7 +589,7 @@ export default {
589 589
 
590 590
                     // Try video only...
591 591
                     return requestedVideo
592
-                        ? createLocalTracks({devices: ['video']}, true)
592
+                        ? createLocalTracksF({devices: ['video']}, true)
593 593
                         : [];
594 594
                 })
595 595
                 .catch(err => {
@@ -781,12 +781,14 @@ export default {
781 781
         }
782 782
 
783 783
         if (!this.localAudio && !mute) {
784
-            createLocalTracks({ devices: ['audio'] }, false)
784
+            const maybeShowErrorDialog = error => {
785
+                showUI && APP.UI.showMicErrorNotification(error);
786
+            };
787
+
788
+            createLocalTracksF({ devices: ['audio'] }, false)
785 789
                 .then(([audioTrack]) => audioTrack)
786 790
                 .catch(error => {
787
-                    if (showUI) {
788
-                        APP.UI.showMicErrorNotification(error);
789
-                    }
791
+                    maybeShowErrorDialog(error);
790 792
 
791 793
                     // Rollback the audio muted status by using null track
792 794
                     return null;
@@ -838,16 +840,14 @@ export default {
838 840
             return;
839 841
         }
840 842
 
841
-        const maybeShowErrorDialog = (error) => {
842
-            if (showUI) {
843
-                APP.UI.showCameraErrorNotification(error);
844
-            }
845
-        };
846
-
847 843
         // FIXME it is possible to queue this task twice, but it's not causing
848 844
         // any issues. Specifically this can happen when the previous
849 845
         // get user media call is blocked on "ask user for permissions" dialog.
850 846
         if (!this.localVideo && !mute) {
847
+            const maybeShowErrorDialog = error => {
848
+                showUI && APP.UI.showCameraErrorNotification(error);
849
+            };
850
+
851 851
             // Try to create local video if there wasn't any.
852 852
             // This handles the case when user joined with no video
853 853
             // (dismissed screen sharing screen or in audio only mode), but
@@ -856,7 +856,7 @@ export default {
856 856
             //
857 857
             // FIXME when local track creation is moved to react/redux
858 858
             // it should take care of the use case described above
859
-            createLocalTracks({ devices: ['video'] }, false)
859
+            createLocalTracksF({ devices: ['video'] }, false)
860 860
                 .then(([videoTrack]) => videoTrack)
861 861
                 .catch(error => {
862 862
                     // FIXME should send some feedback to the API on error ?
@@ -1326,7 +1326,7 @@ export default {
1326 1326
         let promise = null;
1327 1327
 
1328 1328
         if (didHaveVideo) {
1329
-            promise = createLocalTracks({ devices: ['video'] })
1329
+            promise = createLocalTracksF({ devices: ['video'] })
1330 1330
                 .then(([stream]) => this.useVideoStream(stream))
1331 1331
                 .then(() => {
1332 1332
                     JitsiMeetJS.analytics.sendEvent(
@@ -1412,7 +1412,7 @@ export default {
1412 1412
         const didHaveVideo = Boolean(this.localVideo);
1413 1413
         const wasVideoMuted = this.isLocalVideoMuted();
1414 1414
 
1415
-        return createLocalTracks({
1415
+        return createLocalTracksF({
1416 1416
             desktopSharingSources: options.desktopSharingSources,
1417 1417
             devices: ['desktop'],
1418 1418
             desktopSharingExtensionExternalInstallation: {
@@ -2021,7 +2021,7 @@ export default {
2021 2021
             UIEvents.VIDEO_DEVICE_CHANGED,
2022 2022
             (cameraDeviceId) => {
2023 2023
                 JitsiMeetJS.analytics.sendEvent('settings.changeDevice.video');
2024
-                createLocalTracks({
2024
+                createLocalTracksF({
2025 2025
                     devices: ['video'],
2026 2026
                     cameraDeviceId: cameraDeviceId,
2027 2027
                     micDeviceId: null
@@ -2050,7 +2050,7 @@ export default {
2050 2050
             (micDeviceId) => {
2051 2051
                 JitsiMeetJS.analytics.sendEvent(
2052 2052
                     'settings.changeDevice.audioIn');
2053
-                createLocalTracks({
2053
+                createLocalTracksF({
2054 2054
                     devices: ['audio'],
2055 2055
                     cameraDeviceId: null,
2056 2056
                     micDeviceId: micDeviceId
@@ -2281,7 +2281,7 @@ export default {
2281 2281
 
2282 2282
         promises.push(
2283 2283
             mediaDeviceHelper.createLocalTracksAfterDeviceListChanged(
2284
-                    createLocalTracks,
2284
+                    createLocalTracksF,
2285 2285
                     newDevices.videoinput,
2286 2286
                     newDevices.audioinput)
2287 2287
                 .then(tracks =>

+ 2
- 2
react/features/app/middleware.js Visa fil

@@ -5,7 +5,7 @@ import {
5 5
     SET_LOCATION_URL
6 6
 } from '../base/connection';
7 7
 import { MiddlewareRegistry } from '../base/redux';
8
-import { createInitialLocalTracks, destroyLocalTracks } from '../base/tracks';
8
+import { createLocalTracksA, destroyLocalTracks } from '../base/tracks';
9 9
 
10 10
 MiddlewareRegistry.register(store => next => action => {
11 11
     switch (action.type) {
@@ -99,7 +99,7 @@ function _navigate({ dispatch, getState }) {
99 99
         } else {
100 100
             // Create the local tracks if they haven't been created yet.
101 101
             state['features/base/tracks'].some(t => t.local)
102
-                || dispatch(createInitialLocalTracks());
102
+                || dispatch(createLocalTracksA());
103 103
         }
104 104
     }
105 105
 

+ 5
- 5
react/features/base/tracks/actions.js Visa fil

@@ -8,7 +8,7 @@ import {
8 8
 import { getLocalParticipant } from '../participants';
9 9
 
10 10
 import { TRACK_ADDED, TRACK_REMOVED, TRACK_UPDATED } from './actionTypes';
11
-import { createLocalTracks } from './functions';
11
+import { createLocalTracksF } from './functions';
12 12
 
13 13
 /**
14 14
  * Request to start capturing local audio and/or video. By default, the user
@@ -17,7 +17,7 @@ import { createLocalTracks } from './functions';
17 17
  * @param {Object} [options] - For info @see JitsiMeetJS.createLocalTracks.
18 18
  * @returns {Function}
19 19
  */
20
-export function createInitialLocalTracks(options = {}) {
20
+export function createLocalTracksA(options = {}) {
21 21
     return (dispatch, getState) => {
22 22
         const devices
23 23
             = options.devices || [ MEDIA_TYPE.AUDIO, MEDIA_TYPE.VIDEO ];
@@ -28,7 +28,7 @@ export function createInitialLocalTracks(options = {}) {
28 28
 
29 29
         // The following executes on React Native only at the time of this
30 30
         // writing. The effort to port Web's createInitialLocalTracksAndConnect
31
-        // is significant and that's where the function createLocalTracks got
31
+        // is significant and that's where the function createLocalTracksF got
32 32
         // born. I started with the idea a porting so that we could inherit the
33 33
         // ability to getUserMedia for audio only or video only if getUserMedia
34 34
         // for audio and video fails. Eventually though, I realized that on
@@ -37,7 +37,7 @@ export function createInitialLocalTracks(options = {}) {
37 37
         // to implement them) and the right thing to do is to ask for each
38 38
         // device separately.
39 39
         for (const device of devices) {
40
-            createLocalTracks(
40
+            createLocalTracksF(
41 41
                 {
42 42
                     cameraDeviceId: options.cameraDeviceId,
43 43
                     devices: [ device ],
@@ -48,7 +48,7 @@ export function createInitialLocalTracks(options = {}) {
48 48
                 store)
49 49
             .then(localTracks => dispatch(_updateLocalTracks(localTracks)));
50 50
 
51
-            // TODO The function createLocalTracks logs the rejection reason of
51
+            // TODO The function createLocalTracksF logs the rejection reason of
52 52
             // JitsiMeetJS.createLocalTracks so there is no real benefit to
53 53
             // logging it here as well. Technically though,
54 54
             // _updateLocalTracks may cause a rejection so it may be nice to log

+ 1
- 1
react/features/base/tracks/functions.js Visa fil

@@ -23,7 +23,7 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);
23 23
  * is to execute and from which state such as {@code config} is to be retrieved.
24 24
  * @returns {Promise<JitsiLocalTrack[]>}
25 25
  */
26
-export function createLocalTracks(
26
+export function createLocalTracksF(
27 27
         options,
28 28
         firePermissionPromptIsShownEvent,
29 29
         store) {

Laddar…
Avbryt
Spara