瀏覽代碼

fix(lib-jitsi-meet): Use the exported constants

j8
hristoterezov 7 年之前
父節點
當前提交
a3a871d4b3

+ 79
- 82
conference.js 查看文件

@@ -35,7 +35,15 @@ import {
35 35
 import { updateDeviceList } from './react/features/base/devices';
36 36
 import {
37 37
     isAnalyticsEnabled,
38
-    isFatalJitsiConnectionError
38
+    isFatalJitsiConnectionError,
39
+    JitsiConferenceErrors,
40
+    JitsiConferenceEvents,
41
+    JitsiConnectionErrors,
42
+    JitsiConnectionEvents,
43
+    JitsiMediaDevicesEvents,
44
+    JitsiParticipantConnectionStatus,
45
+    JitsiTrackErrors,
46
+    JitsiTrackEvents
39 47
 } from './react/features/base/lib-jitsi-meet';
40 48
 import {
41 49
     isVideoMutedByUser,
@@ -77,17 +85,6 @@ import {
77 85
     showDesktopSharingButton
78 86
 } from './react/features/toolbox';
79 87
 
80
-const { participantConnectionStatus } = JitsiMeetJS.constants;
81
-
82
-const ConnectionEvents = JitsiMeetJS.events.connection;
83
-const ConnectionErrors = JitsiMeetJS.errors.connection;
84
-
85
-const ConferenceEvents = JitsiMeetJS.events.conference;
86
-const ConferenceErrors = JitsiMeetJS.errors.conference;
87
-
88
-const TrackEvents = JitsiMeetJS.events.track;
89
-const TrackErrors = JitsiMeetJS.errors.track;
90
-
91 88
 const eventEmitter = new EventEmitter();
92 89
 
93 90
 let room;
@@ -123,7 +120,7 @@ const commands = {
123 120
 function connect(roomName) {
124 121
     return openConnection({retry: true, roomName: roomName})
125 122
             .catch(function (err) {
126
-                if (err === ConnectionErrors.PASSWORD_REQUIRED) {
123
+                if (err === JitsiConnectionErrors.PASSWORD_REQUIRED) {
127 124
                     APP.UI.notifyTokenAuthFailed();
128 125
                 } else {
129 126
                     APP.UI.notifyConnectionFailed(err);
@@ -270,11 +267,11 @@ class ConferenceConnector {
270 267
         this._resolve = resolve;
271 268
         this._reject = reject;
272 269
         this.reconnectTimeout = null;
273
-        room.on(ConferenceEvents.CONFERENCE_JOINED,
270
+        room.on(JitsiConferenceEvents.CONFERENCE_JOINED,
274 271
             this._handleConferenceJoined.bind(this));
275
-        room.on(ConferenceEvents.CONFERENCE_FAILED,
272
+        room.on(JitsiConferenceEvents.CONFERENCE_FAILED,
276 273
             this._onConferenceFailed.bind(this));
277
-        room.on(ConferenceEvents.CONFERENCE_ERROR,
274
+        room.on(JitsiConferenceEvents.CONFERENCE_ERROR,
278 275
             this._onConferenceError.bind(this));
279 276
     }
280 277
     _handleConferenceFailed(err) {
@@ -286,20 +283,20 @@ class ConferenceConnector {
286 283
         logger.error('CONFERENCE FAILED:', err, ...params);
287 284
 
288 285
         switch (err) {
289
-        case ConferenceErrors.CONNECTION_ERROR: {
286
+        case JitsiConferenceErrors.CONNECTION_ERROR: {
290 287
             let [msg] = params;
291 288
             APP.UI.notifyConnectionFailed(msg);
292 289
             break;
293 290
         }
294 291
 
295
-        case ConferenceErrors.NOT_ALLOWED_ERROR: {
292
+        case JitsiConferenceErrors.NOT_ALLOWED_ERROR: {
296 293
             // let's show some auth not allowed page
297 294
             assignWindowLocationPathname('static/authError.html');
298 295
             break;
299 296
         }
300 297
 
301 298
         // not enough rights to create conference
302
-        case ConferenceErrors.AUTHENTICATION_REQUIRED: {
299
+        case JitsiConferenceErrors.AUTHENTICATION_REQUIRED: {
303 300
             // Schedule reconnect to check if someone else created the room.
304 301
             this.reconnectTimeout = setTimeout(() => room.join(), 5000);
305 302
 
@@ -311,21 +308,21 @@ class ConferenceConnector {
311 308
             break;
312 309
         }
313 310
 
314
-        case ConferenceErrors.RESERVATION_ERROR: {
311
+        case JitsiConferenceErrors.RESERVATION_ERROR: {
315 312
             let [code, msg] = params;
316 313
             APP.UI.notifyReservationError(code, msg);
317 314
             break;
318 315
         }
319 316
 
320
-        case ConferenceErrors.GRACEFUL_SHUTDOWN:
317
+        case JitsiConferenceErrors.GRACEFUL_SHUTDOWN:
321 318
             APP.UI.notifyGracefulShutdown();
322 319
             break;
323 320
 
324
-        case ConferenceErrors.JINGLE_FATAL_ERROR:
321
+        case JitsiConferenceErrors.JINGLE_FATAL_ERROR:
325 322
             APP.UI.notifyInternalError();
326 323
             break;
327 324
 
328
-        case ConferenceErrors.CONFERENCE_DESTROYED: {
325
+        case JitsiConferenceErrors.CONFERENCE_DESTROYED: {
329 326
             let [reason] = params;
330 327
             APP.UI.hideStats();
331 328
             APP.UI.notifyConferenceDestroyed(reason);
@@ -336,26 +333,26 @@ class ConferenceConnector {
336 333
         // What really happens there is that the library is not ready yet,
337 334
         // because Jicofo is not available, but it is going to give it another
338 335
         // try.
339
-        case ConferenceErrors.FOCUS_DISCONNECTED: {
336
+        case JitsiConferenceErrors.FOCUS_DISCONNECTED: {
340 337
             let [focus, retrySec] = params;
341 338
             APP.UI.notifyFocusDisconnected(focus, retrySec);
342 339
             break;
343 340
         }
344 341
 
345
-        case ConferenceErrors.FOCUS_LEFT:
346
-        case ConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE:
342
+        case JitsiConferenceErrors.FOCUS_LEFT:
343
+        case JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE:
347 344
             // FIXME the conference should be stopped by the library and not by
348 345
             // the app. Both the errors above are unrecoverable from the library
349 346
             // perspective.
350 347
             room.leave().then(() => connection.disconnect());
351 348
             break;
352 349
 
353
-        case ConferenceErrors.CONFERENCE_MAX_USERS:
350
+        case JitsiConferenceErrors.CONFERENCE_MAX_USERS:
354 351
             connection.disconnect();
355 352
             APP.UI.notifyMaxUsersLimitReached();
356 353
             break;
357 354
 
358
-        case ConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS:
355
+        case JitsiConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS:
359 356
             reload();
360 357
             break;
361 358
 
@@ -366,7 +363,7 @@ class ConferenceConnector {
366 363
     _onConferenceError(err, ...params) {
367 364
         logger.error('CONFERENCE Error:', err, params);
368 365
         switch (err) {
369
-        case ConferenceErrors.CHAT_ERROR:
366
+        case JitsiConferenceErrors.CHAT_ERROR:
370 367
             logger.error("Chat error.", err);
371 368
             if (isButtonEnabled('chat')) {
372 369
                 let [code, msg] = params;
@@ -379,9 +376,9 @@ class ConferenceConnector {
379 376
     }
380 377
     _unsubscribe() {
381 378
         room.off(
382
-            ConferenceEvents.CONFERENCE_JOINED, this._handleConferenceJoined);
379
+            JitsiConferenceEvents.CONFERENCE_JOINED, this._handleConferenceJoined);
383 380
         room.off(
384
-            ConferenceEvents.CONFERENCE_FAILED, this._onConferenceFailed);
381
+            JitsiConferenceEvents.CONFERENCE_FAILED, this._onConferenceFailed);
385 382
         if (this.reconnectTimeout !== null) {
386 383
             clearTimeout(this.reconnectTimeout);
387 384
         }
@@ -410,14 +407,14 @@ function disconnect() {
410 407
 /**
411 408
  * Handles CONNECTION_FAILED events from lib-jitsi-meet.
412 409
  *
413
- * @param {JitsiMeetJS.connection.error} error - The reported error.
410
+ * @param {JitsiConnectionError} error - The reported error.
414 411
  * @returns {void}
415 412
  * @private
416 413
  */
417 414
 function _connectionFailedHandler(error) {
418 415
     if (isFatalJitsiConnectionError(error)) {
419 416
         APP.connection.removeEventListener(
420
-            ConnectionEvents.CONNECTION_FAILED,
417
+            JitsiConnectionEvents.CONNECTION_FAILED,
421 418
             _connectionFailedHandler);
422 419
         if (room)
423 420
             room.leave();
@@ -517,7 +514,7 @@ export default {
517 514
         }
518 515
 
519 516
         JitsiMeetJS.mediaDevices.addEventListener(
520
-            JitsiMeetJS.events.mediaDevices.PERMISSION_PROMPT_IS_SHOWN,
517
+            JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN,
521 518
             browser =>
522 519
                 APP.store.dispatch(
523 520
                     mediaPermissionPromptVisibilityChanged(true, browser))
@@ -686,7 +683,7 @@ export default {
686 683
                 logger.log('initialized with %s local tracks', tracks.length);
687 684
                 this._localTracksInitialized = true;
688 685
                 con.addEventListener(
689
-                    ConnectionEvents.CONNECTION_FAILED,
686
+                    JitsiConnectionEvents.CONNECTION_FAILED,
690 687
                     _connectionFailedHandler);
691 688
                 APP.connection = connection = con;
692 689
 
@@ -1446,7 +1443,7 @@ export default {
1446 1443
                 = this._turnScreenSharingOff
1447 1444
                       .bind(this, didHaveVideo, wasVideoMuted);
1448 1445
             desktopStream.on(
1449
-                TrackEvents.LOCAL_TRACK_STOPPED,
1446
+                JitsiTrackEvents.LOCAL_TRACK_STOPPED,
1450 1447
                 () => {
1451 1448
                     // If the stream was stopped during screen sharing
1452 1449
                     // session then we should switch back to video.
@@ -1526,13 +1523,13 @@ export default {
1526 1523
      * @private
1527 1524
      */
1528 1525
     _handleScreenSharingError(error) {
1529
-        if (error.name === TrackErrors.CHROME_EXTENSION_USER_CANCELED) {
1526
+        if (error.name === JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED) {
1530 1527
             return;
1531 1528
         }
1532 1529
 
1533 1530
         logger.error('failed to share local desktop', error);
1534 1531
 
1535
-        if (error.name === TrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED) {
1532
+        if (error.name === JitsiTrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED) {
1536 1533
             // If start with screen sharing the extension will fail to install
1537 1534
             // (if not found), because the request has been triggered by the
1538 1535
             // script. Show a dialog which asks user to click "install" and try
@@ -1544,7 +1541,7 @@ export default {
1544 1541
             );
1545 1542
 
1546 1543
             return;
1547
-        } else if (error.name === TrackErrors.FIREFOX_EXTENSION_NEEDED) {
1544
+        } else if (error.name === JitsiTrackErrors.FIREFOX_EXTENSION_NEEDED) {
1548 1545
             APP.UI.showExtensionRequiredDialog(
1549 1546
                 config.desktopSharingFirefoxExtensionURL
1550 1547
             );
@@ -1553,14 +1550,14 @@ export default {
1553 1550
         }
1554 1551
 
1555 1552
         // Handling:
1556
-        // TrackErrors.PERMISSION_DENIED
1557
-        // TrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR
1558
-        // TrackErrors.GENERAL
1553
+        // JitsiTrackErrors.PERMISSION_DENIED
1554
+        // JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR
1555
+        // JitsiTrackErrors.GENERAL
1559 1556
         // and any other
1560 1557
         let dialogTxt;
1561 1558
         let dialogTitleKey;
1562 1559
 
1563
-        if (error.name === TrackErrors.PERMISSION_DENIED) {
1560
+        if (error.name === JitsiTrackErrors.PERMISSION_DENIED) {
1564 1561
             dialogTxt = APP.translation.generateTranslationHTML(
1565 1562
                 "dialog.screenSharingPermissionDeniedError");
1566 1563
             dialogTitleKey = "dialog.error";
@@ -1577,7 +1574,7 @@ export default {
1577 1574
      */
1578 1575
     _setupListeners() {
1579 1576
         // add local streams when joined to the conference
1580
-        room.on(ConferenceEvents.CONFERENCE_JOINED, () => {
1577
+        room.on(JitsiConferenceEvents.CONFERENCE_JOINED, () => {
1581 1578
             APP.store.dispatch(conferenceJoined(room));
1582 1579
 
1583 1580
             APP.UI.mucJoined();
@@ -1586,17 +1583,17 @@ export default {
1586 1583
         });
1587 1584
 
1588 1585
         room.on(
1589
-            ConferenceEvents.CONFERENCE_LEFT,
1586
+            JitsiConferenceEvents.CONFERENCE_LEFT,
1590 1587
             (...args) => APP.store.dispatch(conferenceLeft(room, ...args)));
1591 1588
 
1592 1589
         room.on(
1593
-            ConferenceEvents.AUTH_STATUS_CHANGED,
1590
+            JitsiConferenceEvents.AUTH_STATUS_CHANGED,
1594 1591
             (authEnabled, authLogin) =>
1595 1592
                 APP.UI.updateAuthInfo(authEnabled, authLogin));
1596 1593
 
1597
-        room.on(ConferenceEvents.PARTCIPANT_FEATURES_CHANGED,
1594
+        room.on(JitsiConferenceEvents.PARTCIPANT_FEATURES_CHANGED,
1598 1595
             user => APP.UI.onUserFeaturesChanged(user));
1599
-        room.on(ConferenceEvents.USER_JOINED, (id, user) => {
1596
+        room.on(JitsiConferenceEvents.USER_JOINED, (id, user) => {
1600 1597
             if (user.isHidden())
1601 1598
                 return;
1602 1599
 
@@ -1614,7 +1611,7 @@ export default {
1614 1611
             APP.UI.updateUserRole(user);
1615 1612
         });
1616 1613
 
1617
-        room.on(ConferenceEvents.USER_LEFT, (id, user) => {
1614
+        room.on(JitsiConferenceEvents.USER_LEFT, (id, user) => {
1618 1615
             APP.store.dispatch(participantLeft(id, user));
1619 1616
             logger.log('USER %s LEFT', id, user);
1620 1617
             APP.API.notifyUserLeft(id);
@@ -1622,7 +1619,7 @@ export default {
1622 1619
             APP.UI.onSharedVideoStop(id);
1623 1620
         });
1624 1621
 
1625
-        room.on(ConferenceEvents.USER_STATUS_CHANGED, (id, status) => {
1622
+        room.on(JitsiConferenceEvents.USER_STATUS_CHANGED, (id, status) => {
1626 1623
             APP.store.dispatch(participantPresenceChanged(id, status));
1627 1624
 
1628 1625
             let user = room.getParticipantById(id);
@@ -1631,7 +1628,7 @@ export default {
1631 1628
             }
1632 1629
         });
1633 1630
 
1634
-        room.on(ConferenceEvents.USER_ROLE_CHANGED, (id, role) => {
1631
+        room.on(JitsiConferenceEvents.USER_ROLE_CHANGED, (id, role) => {
1635 1632
             if (this.isLocalId(id)) {
1636 1633
                 logger.info(`My role changed, new role: ${role}`);
1637 1634
 
@@ -1651,21 +1648,21 @@ export default {
1651 1648
             }
1652 1649
         });
1653 1650
 
1654
-        room.on(ConferenceEvents.TRACK_ADDED, (track) => {
1651
+        room.on(JitsiConferenceEvents.TRACK_ADDED, (track) => {
1655 1652
             if (!track || track.isLocal())
1656 1653
                 return;
1657 1654
 
1658 1655
             APP.store.dispatch(trackAdded(track));
1659 1656
         });
1660 1657
 
1661
-        room.on(ConferenceEvents.TRACK_REMOVED, (track) => {
1658
+        room.on(JitsiConferenceEvents.TRACK_REMOVED, (track) => {
1662 1659
             if (!track || track.isLocal())
1663 1660
                 return;
1664 1661
 
1665 1662
             APP.store.dispatch(trackRemoved(track));
1666 1663
         });
1667 1664
 
1668
-        room.on(ConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED, (id, lvl) => {
1665
+        room.on(JitsiConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED, (id, lvl) => {
1669 1666
             if (this.isLocalId(id)
1670 1667
                 && this.localAudio && this.localAudio.isMuted()) {
1671 1668
                 lvl = 0;
@@ -1680,7 +1677,7 @@ export default {
1680 1677
             APP.UI.setAudioLevel(id, lvl);
1681 1678
         });
1682 1679
 
1683
-        room.on(ConferenceEvents.TALK_WHILE_MUTED, () => {
1680
+        room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => {
1684 1681
             APP.UI.showToolbar(6000);
1685 1682
 
1686 1683
             APP.UI.showCustomToolbarPopup(
@@ -1688,23 +1685,23 @@ export default {
1688 1685
         });
1689 1686
 
1690 1687
         room.on(
1691
-            ConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
1688
+            JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
1692 1689
             (leavingIds, enteringIds) =>
1693 1690
                 APP.UI.handleLastNEndpoints(leavingIds, enteringIds));
1694 1691
 
1695 1692
         room.on(
1696
-            ConferenceEvents.P2P_STATUS,
1693
+            JitsiConferenceEvents.P2P_STATUS,
1697 1694
             (jitsiConference, p2p) => APP.store.dispatch(p2pStatusChanged(p2p)));
1698 1695
 
1699 1696
         room.on(
1700
-            ConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
1697
+            JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
1701 1698
             (id, connectionStatus) => {
1702 1699
                 APP.store.dispatch(participantConnectionStatusChanged(
1703 1700
                     id, connectionStatus));
1704 1701
 
1705 1702
                 APP.UI.participantConnectionStatusChanged(id);
1706 1703
             });
1707
-        room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {
1704
+        room.on(JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {
1708 1705
             APP.store.dispatch(dominantSpeakerChanged(id));
1709 1706
 
1710 1707
             if (this.isLocalId(id)) {
@@ -1721,15 +1718,15 @@ export default {
1721 1718
         });
1722 1719
 
1723 1720
         if (!interfaceConfig.filmStripOnly) {
1724
-            room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => {
1721
+            room.on(JitsiConferenceEvents.CONNECTION_INTERRUPTED, () => {
1725 1722
                 APP.UI.markVideoInterrupted(true);
1726 1723
             });
1727
-            room.on(ConferenceEvents.CONNECTION_RESTORED, () => {
1724
+            room.on(JitsiConferenceEvents.CONNECTION_RESTORED, () => {
1728 1725
                 APP.UI.markVideoInterrupted(false);
1729 1726
             });
1730 1727
 
1731 1728
             if (isButtonEnabled('chat')) {
1732
-                room.on(ConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => {
1729
+                room.on(JitsiConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => {
1733 1730
                     let nick = getDisplayName(id);
1734 1731
                     APP.API.notifyReceivedChatMessage({
1735 1732
                         id,
@@ -1767,21 +1764,21 @@ export default {
1767 1764
                 () => this._displayAudioOnlyTooltip('videoMute'));
1768 1765
         }
1769 1766
 
1770
-        room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => {
1767
+        room.on(JitsiConferenceEvents.CONNECTION_INTERRUPTED, () => {
1771 1768
             APP.store.dispatch(localParticipantConnectionStatusChanged(
1772
-                participantConnectionStatus.INTERRUPTED));
1769
+                JitsiParticipantConnectionStatus.INTERRUPTED));
1773 1770
 
1774 1771
             APP.UI.showLocalConnectionInterrupted(true);
1775 1772
         });
1776 1773
 
1777
-        room.on(ConferenceEvents.CONNECTION_RESTORED, () => {
1774
+        room.on(JitsiConferenceEvents.CONNECTION_RESTORED, () => {
1778 1775
             APP.store.dispatch(localParticipantConnectionStatusChanged(
1779
-                participantConnectionStatus.ACTIVE));
1776
+                JitsiParticipantConnectionStatus.ACTIVE));
1780 1777
 
1781 1778
             APP.UI.showLocalConnectionInterrupted(false);
1782 1779
         });
1783 1780
 
1784
-        room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => {
1781
+        room.on(JitsiConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => {
1785 1782
             const formattedDisplayName
1786 1783
                 = displayName.substr(0, MAX_DISPLAY_NAME_LENGTH);
1787 1784
             APP.store.dispatch(participantUpdated({
@@ -1793,7 +1790,7 @@ export default {
1793 1790
         });
1794 1791
 
1795 1792
         room.on(
1796
-            ConferenceEvents.LOCK_STATE_CHANGED,
1793
+            JitsiConferenceEvents.LOCK_STATE_CHANGED,
1797 1794
             (...args) => APP.store.dispatch(lockStateChanged(room, ...args)));
1798 1795
 
1799 1796
         APP.remoteControl.on(RemoteControlEvents.ACTIVE_CHANGED, isActive => {
@@ -1805,7 +1802,7 @@ export default {
1805 1802
         });
1806 1803
 
1807 1804
         room.on(
1808
-            ConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
1805
+            JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
1809 1806
             (participant, name, oldValue, newValue) => {
1810 1807
                 switch (name) {
1811 1808
                 case 'raisedHand':
@@ -1821,18 +1818,18 @@ export default {
1821 1818
                 }
1822 1819
             });
1823 1820
 
1824
-        room.on(ConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => {
1821
+        room.on(JitsiConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => {
1825 1822
             logger.log("Received recorder status change: ", status, error);
1826 1823
             APP.UI.updateRecordingState(status);
1827 1824
         });
1828 1825
 
1829
-        room.on(ConferenceEvents.KICKED, () => {
1826
+        room.on(JitsiConferenceEvents.KICKED, () => {
1830 1827
             APP.UI.hideStats();
1831 1828
             APP.UI.notifyKicked();
1832 1829
             // FIXME close
1833 1830
         });
1834 1831
 
1835
-        room.on(ConferenceEvents.SUSPEND_DETECTED, () => {
1832
+        room.on(JitsiConferenceEvents.SUSPEND_DETECTED, () => {
1836 1833
             APP.store.dispatch(suspendDetected());
1837 1834
             // After wake up, we will be in a state where conference is left
1838 1835
             // there will be dialog shown to user.
@@ -1843,7 +1840,7 @@ export default {
1843 1840
             // on resume after suspending PC.
1844 1841
             if (this.deviceChangeListener)
1845 1842
                 JitsiMeetJS.mediaDevices.removeEventListener(
1846
-                    JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED,
1843
+                    JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED,
1847 1844
                     this.deviceChangeListener);
1848 1845
 
1849 1846
             // stop local video
@@ -1858,7 +1855,7 @@ export default {
1858 1855
             }
1859 1856
         });
1860 1857
 
1861
-        room.on(ConferenceEvents.DTMF_SUPPORT_CHANGED, (isDTMFSupported) => {
1858
+        room.on(JitsiConferenceEvents.DTMF_SUPPORT_CHANGED, (isDTMFSupported) => {
1862 1859
             APP.UI.updateDTMFSupport(isDTMFSupported);
1863 1860
         });
1864 1861
 
@@ -1921,24 +1918,24 @@ export default {
1921 1918
             }
1922 1919
         );
1923 1920
         room.on(
1924
-            ConferenceEvents.START_MUTED_POLICY_CHANGED,
1921
+            JitsiConferenceEvents.START_MUTED_POLICY_CHANGED,
1925 1922
             ({ audio, video }) => {
1926 1923
                 APP.UI.onStartMutedChanged(audio, video);
1927 1924
             }
1928 1925
         );
1929
-        room.on(ConferenceEvents.STARTED_MUTED, () => {
1926
+        room.on(JitsiConferenceEvents.STARTED_MUTED, () => {
1930 1927
             (room.isStartAudioMuted() || room.isStartVideoMuted())
1931 1928
                 && APP.UI.notifyInitiallyMuted();
1932 1929
         });
1933 1930
 
1934 1931
         room.on(
1935
-            ConferenceEvents.AVAILABLE_DEVICES_CHANGED, function (id, devices) {
1932
+            JitsiConferenceEvents.AVAILABLE_DEVICES_CHANGED, function (id, devices) {
1936 1933
                 APP.UI.updateDevicesAvailability(id, devices);
1937 1934
             }
1938 1935
         );
1939 1936
 
1940 1937
         room.on(
1941
-            ConferenceEvents.DATA_CHANNEL_OPENED, () => {
1938
+            JitsiConferenceEvents.DATA_CHANNEL_OPENED, () => {
1942 1939
                 APP.store.dispatch(dataChannelOpened());
1943 1940
             }
1944 1941
         );
@@ -1989,7 +1986,7 @@ export default {
1989 1986
         APP.UI.addListener(UIEvents.SUBJECT_CHANGED, (topic) => {
1990 1987
             room.setSubject(topic);
1991 1988
         });
1992
-        room.on(ConferenceEvents.SUBJECT_CHANGED, function (subject) {
1989
+        room.on(JitsiConferenceEvents.SUBJECT_CHANGED, function (subject) {
1993 1990
             APP.UI.setSubject(subject);
1994 1991
         });
1995 1992
 
@@ -2152,7 +2149,7 @@ export default {
2152 2149
     },
2153 2150
     /**
2154 2151
     * Adds any room listener.
2155
-    * @param {string} eventName one of the ConferenceEvents
2152
+    * @param {string} eventName one of the JitsiConferenceEvents
2156 2153
     * @param {Function} listener the function to be called when the event
2157 2154
     * occurs
2158 2155
     */
@@ -2162,7 +2159,7 @@ export default {
2162 2159
 
2163 2160
     /**
2164 2161
     * Removes any room listener.
2165
-    * @param {string} eventName one of the ConferenceEvents
2162
+    * @param {string} eventName one of the JitsiConferenceEvents
2166 2163
     * @param {Function} listener the listener to be removed.
2167 2164
     */
2168 2165
     removeConferenceListener(eventName, listener) {
@@ -2202,7 +2199,7 @@ export default {
2202 2199
                         window.setTimeout(
2203 2200
                             () => this._onDeviceListChanged(devices), 0);
2204 2201
                     JitsiMeetJS.mediaDevices.addEventListener(
2205
-                        JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED,
2202
+                        JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED,
2206 2203
                         this.deviceChangeListener);
2207 2204
                 }
2208 2205
             })

+ 10
- 10
connection.js 查看文件

@@ -8,11 +8,11 @@ import {
8 8
     connectionFailed
9 9
 } from './react/features/base/connection';
10 10
 import {
11
-    isFatalJitsiConnectionError
11
+    isFatalJitsiConnectionError,
12
+    JitsiConnectionErrors,
13
+    JitsiConnectionEvents
12 14
 } from './react/features/base/lib-jitsi-meet';
13 15
 
14
-const ConnectionEvents = JitsiMeetJS.events.connection;
15
-const ConnectionErrors = JitsiMeetJS.errors.connection;
16 16
 const logger = require("jitsi-meet-logger").getLogger(__filename);
17 17
 
18 18
 /**
@@ -74,13 +74,13 @@ function connect(id, password, roomName) {
74 74
 
75 75
     return new Promise(function (resolve, reject) {
76 76
         connection.addEventListener(
77
-            ConnectionEvents.CONNECTION_ESTABLISHED,
77
+            JitsiConnectionEvents.CONNECTION_ESTABLISHED,
78 78
             handleConnectionEstablished);
79 79
         connection.addEventListener(
80
-            ConnectionEvents.CONNECTION_FAILED,
80
+            JitsiConnectionEvents.CONNECTION_FAILED,
81 81
             handleConnectionFailed);
82 82
         connection.addEventListener(
83
-            ConnectionEvents.CONNECTION_FAILED,
83
+            JitsiConnectionEvents.CONNECTION_FAILED,
84 84
             connectionFailedHandler);
85 85
 
86 86
         function connectionFailedHandler(error, message, credentials) {
@@ -89,17 +89,17 @@ function connect(id, password, roomName) {
89 89
 
90 90
             if (isFatalJitsiConnectionError(error)) {
91 91
                 connection.removeEventListener(
92
-                    ConnectionEvents.CONNECTION_FAILED,
92
+                    JitsiConnectionEvents.CONNECTION_FAILED,
93 93
                     connectionFailedHandler);
94 94
             }
95 95
         }
96 96
 
97 97
         function unsubscribe() {
98 98
             connection.removeEventListener(
99
-                ConnectionEvents.CONNECTION_ESTABLISHED,
99
+                JitsiConnectionEvents.CONNECTION_ESTABLISHED,
100 100
                 handleConnectionEstablished);
101 101
             connection.removeEventListener(
102
-                ConnectionEvents.CONNECTION_FAILED,
102
+                JitsiConnectionEvents.CONNECTION_FAILED,
103 103
                 handleConnectionFailed);
104 104
         }
105 105
 
@@ -149,7 +149,7 @@ export function openConnection({id, password, retry, roomName}) {
149 149
         if (retry) {
150 150
             const { issuer, jwt } = APP.store.getState()['features/base/jwt'];
151 151
 
152
-            if (err === ConnectionErrors.PASSWORD_REQUIRED
152
+            if (err === JitsiConnectionErrors.PASSWORD_REQUIRED
153 153
                     && (!jwt || issuer === 'anonymous')) {
154 154
                 return AuthHandler.requestAuth(roomName, connect);
155 155
             }

+ 29
- 23
modules/UI/UI.js 查看文件

@@ -1,4 +1,4 @@
1
-/* global APP, JitsiMeetJS, $, config, interfaceConfig */
1
+/* global APP, $, config, interfaceConfig */
2 2
 
3 3
 const logger = require("jitsi-meet-logger").getLogger(__filename);
4 4
 
@@ -22,6 +22,7 @@ import Profile from "./side_pannels/profile/Profile";
22 22
 import Settings from "./../settings/Settings";
23 23
 
24 24
 import { updateDeviceList } from '../../react/features/base/devices';
25
+import { JitsiTrackErrors } from '../../react/features/base/lib-jitsi-meet';
25 26
 import {
26 27
     openDeviceSelectionDialog
27 28
 } from '../../react/features/device-selection';
@@ -54,35 +55,38 @@ let sharedVideoManager;
54 55
 
55 56
 let followMeHandler;
56 57
 
57
-const TrackErrors = JitsiMeetJS.errors.track;
58
-
59 58
 const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = {
60 59
     microphone: {},
61 60
     camera: {}
62 61
 };
63 62
 
64
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.UNSUPPORTED_RESOLUTION]
65
-    = "dialog.cameraUnsupportedResolutionError";
66
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.GENERAL]
63
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
64
+    .camera[JitsiTrackErrors.UNSUPPORTED_RESOLUTION]
65
+        = "dialog.cameraUnsupportedResolutionError";
66
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.GENERAL]
67 67
     = "dialog.cameraUnknownError";
68
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.PERMISSION_DENIED]
68
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.PERMISSION_DENIED]
69 69
     = "dialog.cameraPermissionDeniedError";
70
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.NOT_FOUND]
70
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.NOT_FOUND]
71 71
     = "dialog.cameraNotFoundError";
72
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.CONSTRAINT_FAILED]
72
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.CONSTRAINT_FAILED]
73 73
     = "dialog.cameraConstraintFailedError";
74
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.NO_DATA_FROM_SOURCE]
75
-    = "dialog.cameraNotSendingData";
76
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.GENERAL]
74
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
75
+    .camera[JitsiTrackErrors.NO_DATA_FROM_SOURCE]
76
+        = "dialog.cameraNotSendingData";
77
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.GENERAL]
77 78
     = "dialog.micUnknownError";
78
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.PERMISSION_DENIED]
79
-    = "dialog.micPermissionDeniedError";
80
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NOT_FOUND]
79
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
80
+    .microphone[JitsiTrackErrors.PERMISSION_DENIED]
81
+        = "dialog.micPermissionDeniedError";
82
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.NOT_FOUND]
81 83
     = "dialog.micNotFoundError";
82
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.CONSTRAINT_FAILED]
83
-    = "dialog.micConstraintFailedError";
84
-JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NO_DATA_FROM_SOURCE]
85
-    = "dialog.micNotSendingData";
84
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
85
+    .microphone[JitsiTrackErrors.CONSTRAINT_FAILED]
86
+        = "dialog.micConstraintFailedError";
87
+JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
88
+    .microphone[JitsiTrackErrors.NO_DATA_FROM_SOURCE]
89
+        = "dialog.micNotSendingData";
86 90
 
87 91
 /**
88 92
  * Toggles the application in and out of full screen mode
@@ -1073,7 +1077,8 @@ UI.showMicErrorNotification = function (micError) {
1073 1077
     const micJitsiTrackErrorMsg
1074 1078
         = JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[name];
1075 1079
     const micErrorMsg = micJitsiTrackErrorMsg
1076
-        || JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.GENERAL];
1080
+        || JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
1081
+            .microphone[JitsiTrackErrors.GENERAL];
1077 1082
     const additionalMicErrorMsg = micJitsiTrackErrorMsg ? null : message;
1078 1083
 
1079 1084
     APP.store.dispatch(maybeShowNotificationWithDoNotDisplay(
@@ -1083,7 +1088,7 @@ UI.showMicErrorNotification = function (micError) {
1083 1088
             messageKey: micErrorMsg,
1084 1089
             showToggle: Boolean(micJitsiTrackErrorMsg),
1085 1090
             subtitleKey: 'dialog.micErrorPresent',
1086
-            titleKey: name === TrackErrors.PERMISSION_DENIED
1091
+            titleKey: name === JitsiTrackErrors.PERMISSION_DENIED
1087 1092
                 ? 'deviceError.microphonePermission' : 'dialog.error',
1088 1093
             toggleLabelKey: 'dialog.doNotShowWarningAgain'
1089 1094
         }));
@@ -1108,7 +1113,8 @@ UI.showCameraErrorNotification = function (cameraError) {
1108 1113
     const cameraJitsiTrackErrorMsg =
1109 1114
         JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[name];
1110 1115
     const cameraErrorMsg = cameraJitsiTrackErrorMsg
1111
-        || JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.GENERAL];
1116
+        || JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
1117
+            .camera[JitsiTrackErrors.GENERAL];
1112 1118
     const additionalCameraErrorMsg = cameraJitsiTrackErrorMsg ? null : message;
1113 1119
 
1114 1120
     APP.store.dispatch(maybeShowNotificationWithDoNotDisplay(
@@ -1118,7 +1124,7 @@ UI.showCameraErrorNotification = function (cameraError) {
1118 1124
             messageKey: cameraErrorMsg,
1119 1125
             showToggle: Boolean(cameraJitsiTrackErrorMsg),
1120 1126
             subtitleKey: 'dialog.cameraErrorPresent',
1121
-            titleKey: name === TrackErrors.PERMISSION_DENIED
1127
+            titleKey: name === JitsiTrackErrors.PERMISSION_DENIED
1122 1128
                 ? 'deviceError.cameraPermission' : 'dialog.error',
1123 1129
             toggleLabelKey: 'dialog.doNotShowWarningAgain'
1124 1130
         }));

+ 5
- 3
modules/UI/authentication/AuthHandler.js 查看文件

@@ -2,11 +2,13 @@
2 2
 
3 3
 import { openConnection } from '../../../connection';
4 4
 import { setJWT } from '../../../react/features/base/jwt';
5
+import {
6
+    JitsiConnectionErrors
7
+} from '../../../react/features/base/lib-jitsi-meet';
5 8
 import UIUtil from '../util/UIUtil';
6 9
 
7 10
 import LoginDialog from './LoginDialog';
8 11
 
9
-const ConnectionErrors = JitsiMeetJS.errors.connection;
10 12
 const logger = require("jitsi-meet-logger").getLogger(__filename);
11 13
 
12 14
 let externalAuthWindow;
@@ -247,7 +249,7 @@ function showXmppPasswordPrompt(roomName, connect) {
247 249
                     authDialog.close();
248 250
                     resolve(connection);
249 251
                 }, function (err) {
250
-                    if (err === ConnectionErrors.PASSWORD_REQUIRED) {
252
+                    if (err === JitsiConnectionErrors.PASSWORD_REQUIRED) {
251 253
                         authDialog.displayError(err);
252 254
                     } else {
253 255
                         authDialog.close();
@@ -266,7 +268,7 @@ function showXmppPasswordPrompt(roomName, connect) {
266 268
  * @param {string} [roomName] name of the conference room
267 269
  * @param {function(id, password, roomName)} [connect] function that returns
268 270
  * a Promise which resolves with JitsiConnection or fails with one of
269
- * ConnectionErrors.
271
+ * JitsiConnectionErrors.
270 272
  * @returns {Promise<JitsiConnection>}
271 273
  */
272 274
 function requestAuth(roomName, connect) {

+ 6
- 5
modules/UI/authentication/LoginDialog.js 查看文件

@@ -1,8 +1,9 @@
1
-/* global $, APP, config, JitsiMeetJS */
1
+/* global $, APP, config */
2 2
 
3 3
 import { toJid } from '../../../react/features/base/connection';
4
-
5
-const ConnectionErrors = JitsiMeetJS.errors.connection;
4
+import {
5
+    JitsiConnectionErrors
6
+} from '../../../react/features/base/lib-jitsi-meet';
6 7
 
7 8
 /**
8 9
  * Build html for "password required" dialog.
@@ -14,7 +15,7 @@ function getPasswordInputHtml() {
14 15
         : "user@domain.net";
15 16
 
16 17
     return `
17
-        <input name="username" type="text" 
18
+        <input name="username" type="text"
18 19
                class="input-control"
19 20
                placeholder=${placeholder} autofocus>
20 21
         <input name="password" type="password"
@@ -121,7 +122,7 @@ function LoginDialog(successCallback, cancelCallback) {
121 122
         let errorMessageElem = finishedState.find('#errorMessage');
122 123
 
123 124
         let messageKey;
124
-        if (error === ConnectionErrors.PASSWORD_REQUIRED) {
125
+        if (error === JitsiConnectionErrors.PASSWORD_REQUIRED) {
125 126
             // this is a password required error, as login window was already
126 127
             // open once, this means username or password is wrong
127 128
             messageKey = 'dialog.incorrectPassword';

+ 22
- 21
modules/UI/recording/Recording.js 查看文件

@@ -20,6 +20,9 @@ import UIEvents from "../../../service/UI/UIEvents";
20 20
 import UIUtil from '../util/UIUtil';
21 21
 import VideoLayout from '../videolayout/VideoLayout';
22 22
 
23
+import {
24
+    JitsiRecordingStatus
25
+} from '../../../react/features/base/lib-jitsi-meet';
23 26
 import { setToolboxEnabled } from '../../../react/features/toolbox';
24 27
 import { setNotificationsEnabled } from '../../../react/features/notifications';
25 28
 import {
@@ -27,8 +30,6 @@ import {
27 30
     updateRecordingState
28 31
 } from '../../../react/features/recording';
29 32
 
30
-const Status = JitsiMeetJS.constants.recordingStatus;
31
-
32 33
 /**
33 34
  * Translation keys to use for display in the UI when recording the conference
34 35
  * but not streaming live.
@@ -240,11 +241,11 @@ function _showStopRecordingPrompt(recordingType) {
240 241
 
241 242
 /**
242 243
  * Checks whether if the given status is either PENDING or RETRYING
243
- * @param status {Status} Jibri status to be checked
244
+ * @param status {JitsiRecordingStatus} Jibri status to be checked
244 245
  * @returns {boolean} true if the condition is met or false otherwise.
245 246
  */
246 247
 function isStartingStatus(status) {
247
-    return status === Status.PENDING || status === Status.RETRYING;
248
+    return status === JitsiRecordingStatus.PENDING || status === JitsiRecordingStatus.RETRYING;
248 249
 }
249 250
 
250 251
 /**
@@ -340,12 +341,12 @@ var Recording = {
340 341
         let labelDisplayConfiguration;
341 342
 
342 343
         switch (recordingState) {
343
-        case Status.ON:
344
-        case Status.RETRYING: {
344
+        case JitsiRecordingStatus.ON:
345
+        case JitsiRecordingStatus.RETRYING: {
345 346
             labelDisplayConfiguration = {
346 347
                 centered: false,
347 348
                 key: this.recordingOnKey,
348
-                showSpinner: recordingState === Status.RETRYING
349
+                showSpinner: recordingState === JitsiRecordingStatus.RETRYING
349 350
             };
350 351
 
351 352
             this._setToolbarButtonToggled(true);
@@ -353,14 +354,14 @@ var Recording = {
353 354
             break;
354 355
         }
355 356
 
356
-        case Status.OFF:
357
-        case Status.BUSY:
358
-        case Status.FAILED:
359
-        case Status.UNAVAILABLE: {
357
+        case JitsiRecordingStatus.OFF:
358
+        case JitsiRecordingStatus.BUSY:
359
+        case JitsiRecordingStatus.FAILED:
360
+        case JitsiRecordingStatus.UNAVAILABLE: {
360 361
             const wasInStartingStatus = isStartingStatus(oldState);
361 362
 
362 363
             // We don't want UI changes if this is an availability change.
363
-            if (oldState !== Status.ON && !wasInStartingStatus) {
364
+            if (oldState !== JitsiRecordingStatus.ON && !wasInStartingStatus) {
364 365
                 APP.store.dispatch(updateRecordingState({ recordingState }));
365 366
                 return;
366 367
             }
@@ -381,7 +382,7 @@ var Recording = {
381 382
             break;
382 383
         }
383 384
 
384
-        case Status.PENDING: {
385
+        case JitsiRecordingStatus.PENDING: {
385 386
             labelDisplayConfiguration = {
386 387
                 centered: true,
387 388
                 key: this.recordingPendingKey
@@ -392,7 +393,7 @@ var Recording = {
392 393
             break;
393 394
         }
394 395
 
395
-        case Status.ERROR: {
396
+        case JitsiRecordingStatus.ERROR: {
396 397
             labelDisplayConfiguration = {
397 398
                 centered: true,
398 399
                 key: this.recordingErrorKey
@@ -404,7 +405,7 @@ var Recording = {
404 405
         }
405 406
 
406 407
         // Return an empty label display configuration to indicate no label
407
-        // should be displayed. The Status.AVAIABLE case is handled here.
408
+        // should be displayed. The JitsiRecordingStatus.AVAIABLE case is handled here.
408 409
         default: {
409 410
             labelDisplayConfiguration = null;
410 411
         }
@@ -438,9 +439,9 @@ var Recording = {
438 439
 
439 440
         JitsiMeetJS.analytics.sendEvent('recording.clicked');
440 441
         switch (this.currentState) {
441
-        case Status.ON:
442
-        case Status.RETRYING:
443
-        case Status.PENDING: {
442
+        case JitsiRecordingStatus.ON:
443
+        case JitsiRecordingStatus.RETRYING:
444
+        case JitsiRecordingStatus.PENDING: {
444 445
             _showStopRecordingPrompt(this.recordingType).then(
445 446
                 () => {
446 447
                     this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED);
@@ -449,8 +450,8 @@ var Recording = {
449 450
                 () => {});
450 451
             break;
451 452
         }
452
-        case Status.AVAILABLE:
453
-        case Status.OFF: {
453
+        case JitsiRecordingStatus.AVAILABLE:
454
+        case JitsiRecordingStatus.OFF: {
454 455
             if (this.recordingType === 'jibri')
455 456
                 _requestLiveStreamId().then(streamId => {
456 457
                     this.eventEmitter.emit(
@@ -486,7 +487,7 @@ var Recording = {
486 487
             }
487 488
             break;
488 489
         }
489
-        case Status.BUSY: {
490
+        case JitsiRecordingStatus.BUSY: {
490 491
             dialog = APP.UI.messageHandler.openMessageDialog(
491 492
                 this.recordingTitle,
492 493
                 this.recordingBusy,

+ 9
- 7
modules/UI/videolayout/LargeVideoManager.js 查看文件

@@ -9,6 +9,9 @@ import { PresenceLabel } from '../../../react/features/presence-status';
9 9
 
10 10
 const logger = require("jitsi-meet-logger").getLogger(__filename);
11 11
 
12
+import {
13
+    JitsiParticipantConnectionStatus
14
+} from '../../../react/features/base/lib-jitsi-meet';
12 15
 import {
13 16
     updateKnownLargeVideoResolution
14 17
 } from '../../../react/features/large-video';
@@ -21,8 +24,6 @@ import {VideoContainer, VIDEO_CONTAINER_TYPE} from "./VideoContainer";
21 24
 
22 25
 import AudioLevels from "../audio_levels/AudioLevels";
23 26
 
24
-const ParticipantConnectionStatus
25
-    = JitsiMeetJS.constants.participantConnectionStatus;
26 27
 const DESKTOP_CONTAINER_TYPE = 'desktop';
27 28
 /**
28 29
  * The time interval in milliseconds to check the video resolution of the video
@@ -211,7 +212,7 @@ export default class LargeVideoManager {
211 212
                 = !isVideoMuted
212 213
                     && (APP.conference.isLocalId(id)
213 214
                         || connectionStatus
214
-                                === ParticipantConnectionStatus.ACTIVE
215
+                                === JitsiParticipantConnectionStatus.ACTIVE
215 216
                         || wasUsersImageCached);
216 217
 
217 218
             let showAvatar
@@ -241,13 +242,13 @@ export default class LargeVideoManager {
241 242
 
242 243
             const isConnectionInterrupted
243 244
                 = APP.conference.getParticipantConnectionStatus(id)
244
-                    === ParticipantConnectionStatus.INTERRUPTED;
245
+                    === JitsiParticipantConnectionStatus.INTERRUPTED;
245 246
             let messageKey = null;
246 247
 
247 248
             if (isConnectionInterrupted) {
248 249
                 messageKey = "connection.USER_CONNECTION_INTERRUPTED";
249 250
             } else if (connectionStatus
250
-                    === ParticipantConnectionStatus.INACTIVE) {
251
+                    === JitsiParticipantConnectionStatus.INACTIVE) {
251 252
                 messageKey = "connection.LOW_BANDWIDTH";
252 253
             }
253 254
 
@@ -494,8 +495,9 @@ export default class LargeVideoManager {
494 495
                 = APP.conference.getParticipantConnectionStatus(this.id);
495 496
 
496 497
             show = !APP.conference.isLocalId(this.id)
497
-                && (connStatus === ParticipantConnectionStatus.INTERRUPTED
498
-                    || connStatus === ParticipantConnectionStatus.INACTIVE);
498
+                && (connStatus === JitsiParticipantConnectionStatus.INTERRUPTED
499
+                    || connStatus
500
+                        === JitsiParticipantConnectionStatus.INACTIVE);
499 501
         }
500 502
 
501 503
         if (show) {

+ 4
- 5
modules/UI/videolayout/LocalVideo.js 查看文件

@@ -1,10 +1,11 @@
1
-/* global $, config, interfaceConfig, APP, JitsiMeetJS */
1
+/* global $, config, interfaceConfig, APP */
2 2
 
3 3
 /* eslint-disable no-unused-vars */
4 4
 import React, { Component } from 'react';
5 5
 import ReactDOM from 'react-dom';
6 6
 import { Provider } from 'react-redux';
7 7
 
8
+import { JitsiTrackEvents } from '../../../react/features/base/lib-jitsi-meet';
8 9
 import { VideoTrack } from '../../../react/features/base/media';
9 10
 /* eslint-enable no-unused-vars */
10 11
 
@@ -13,8 +14,6 @@ const logger = require("jitsi-meet-logger").getLogger(__filename);
13 14
 import UIEvents from "../../../service/UI/UIEvents";
14 15
 import SmallVideo from "./SmallVideo";
15 16
 
16
-const TrackEvents = JitsiMeetJS.events.track;
17
-
18 17
 function LocalVideo(VideoLayout, emitter) {
19 18
     this.videoSpanId = "localVideoContainer";
20 19
 
@@ -159,9 +158,9 @@ LocalVideo.prototype.changeVideo = function (stream) {
159 158
         if (this.isCurrentlyOnLargeVideo()) {
160 159
             this.VideoLayout.updateLargeVideo(this.id);
161 160
         }
162
-        stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
161
+        stream.off(JitsiTrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
163 162
     };
164
-    stream.on(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
163
+    stream.on(JitsiTrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
165 164
 };
166 165
 
167 166
 /**

+ 9
- 9
modules/UI/videolayout/RemoteVideo.js 查看文件

@@ -1,4 +1,4 @@
1
-/* global $, APP, interfaceConfig, JitsiMeetJS */
1
+/* global $, APP, interfaceConfig */
2 2
 
3 3
 /* eslint-disable no-unused-vars */
4 4
 import React from 'react';
@@ -7,6 +7,9 @@ import { Provider } from 'react-redux';
7 7
 import { I18nextProvider } from 'react-i18next';
8 8
 
9 9
 import { i18next } from '../../../react/features/base/i18n';
10
+import {
11
+    JitsiParticipantConnectionStatus
12
+} from '../../../react/features/base/lib-jitsi-meet';
10 13
 
11 14
 import { PresenceLabel } from '../../../react/features/presence-status';
12 15
 import {
@@ -21,9 +24,6 @@ const logger = require("jitsi-meet-logger").getLogger(__filename);
21 24
 import SmallVideo from "./SmallVideo";
22 25
 import UIUtils from "../util/UIUtil";
23 26
 
24
-const ParticipantConnectionStatus
25
-    = JitsiMeetJS.constants.participantConnectionStatus;
26
-
27 27
 /**
28 28
  * Creates new instance of the <tt>RemoteVideo</tt>.
29 29
  * @param user {JitsiParticipant} the user for whom remote video instance will
@@ -379,14 +379,14 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) {
379 379
  */
380 380
 RemoteVideo.prototype.isConnectionActive = function() {
381 381
     return this.user.getConnectionStatus()
382
-        === ParticipantConnectionStatus.ACTIVE;
382
+        === JitsiParticipantConnectionStatus.ACTIVE;
383 383
 };
384 384
 
385 385
 /**
386 386
  * The remote video is considered "playable" once the stream has started
387 387
  * according to the {@link #hasVideoStarted} result.
388 388
  * It will be allowed to display video also in
389
- * {@link ParticipantConnectionStatus.INTERRUPTED} if the video was ever played
389
+ * {@link JitsiParticipantConnectionStatus.INTERRUPTED} if the video was ever played
390 390
  * and was not muted while not in ACTIVE state. This basically means that there
391 391
  * is stalled video image cached that could be displayed. It's used to show
392 392
  * "grey video image" in user's thumbnail when there are connectivity issues.
@@ -400,8 +400,8 @@ RemoteVideo.prototype.isVideoPlayable = function () {
400 400
 
401 401
     return SmallVideo.prototype.isVideoPlayable.call(this)
402 402
         && this.hasVideoStarted()
403
-        && (connectionState === ParticipantConnectionStatus.ACTIVE
404
-            || (connectionState === ParticipantConnectionStatus.INTERRUPTED
403
+        && (connectionState === JitsiParticipantConnectionStatus.ACTIVE
404
+            || (connectionState === JitsiParticipantConnectionStatus.INTERRUPTED
405 405
                     && !this.mutedWhileDisconnected));
406 406
 };
407 407
 
@@ -432,7 +432,7 @@ RemoteVideo.prototype.updateConnectionStatusIndicator = function () {
432 432
     this.updateConnectionStatus(connectionStatus);
433 433
 
434 434
     const isInterrupted
435
-        = connectionStatus === ParticipantConnectionStatus.INTERRUPTED;
435
+        = connectionStatus === JitsiParticipantConnectionStatus.INTERRUPTED;
436 436
     // Toggle thumbnail video problem filter
437 437
     this.selectVideoElement().toggleClass(
438 438
         "videoThumbnailProblemFilter", isInterrupted);

+ 6
- 6
modules/UI/videolayout/VideoLayout.js 查看文件

@@ -1,6 +1,9 @@
1
-/* global APP, $, interfaceConfig, JitsiMeetJS  */
1
+/* global APP, $, interfaceConfig  */
2 2
 const logger = require("jitsi-meet-logger").getLogger(__filename);
3 3
 
4
+import {
5
+    JitsiParticipantConnectionStatus
6
+} from '../../../react/features/base/lib-jitsi-meet';
4 7
 import {
5 8
     getPinnedParticipant,
6 9
     pinParticipant
@@ -15,9 +18,6 @@ import LargeVideoManager  from "./LargeVideoManager";
15 18
 import {VIDEO_CONTAINER_TYPE} from "./VideoContainer";
16 19
 import LocalVideo from "./LocalVideo";
17 20
 
18
-const ParticipantConnectionStatus
19
-    = JitsiMeetJS.constants.participantConnectionStatus;
20
-
21 21
 var remoteVideos = {};
22 22
 var localVideoThumbnail = null;
23 23
 
@@ -593,8 +593,8 @@ var VideoLayout = {
593 593
         // states.
594 594
         const status
595 595
             = isInterrupted
596
-                ? ParticipantConnectionStatus.INTERRUPTED
597
-                : ParticipantConnectionStatus.ACTIVE;
596
+                ? JitsiParticipantConnectionStatus.INTERRUPTED
597
+                : JitsiParticipantConnectionStatus.ACTIVE;
598 598
 
599 599
         localVideoThumbnail.updateConnectionStatus(status);
600 600
     },

+ 12
- 10
modules/remotecontrol/Controller.js 查看文件

@@ -2,6 +2,9 @@
2 2
 
3 3
 import { getLogger } from 'jitsi-meet-logger';
4 4
 
5
+import {
6
+    JitsiConferenceEvents
7
+} from '../../react/features/base/lib-jitsi-meet';
5 8
 import * as KeyCodes from '../keycode/keycode';
6 9
 import {
7 10
     EVENTS,
@@ -16,9 +19,7 @@ import RemoteControlParticipant from './RemoteControlParticipant';
16 19
 
17 20
 declare var $: Function;
18 21
 declare var APP: Object;
19
-declare var JitsiMeetJS: Object;
20 22
 
21
-const ConferenceEvents = JitsiMeetJS.events.conference;
22 23
 const logger = getLogger(__filename);
23 24
 
24 25
 /**
@@ -122,10 +123,10 @@ export default class Controller extends RemoteControlParticipant {
122 123
             const clearRequest = () => {
123 124
                 this._requestedParticipant = null;
124 125
                 APP.conference.removeConferenceListener(
125
-                    ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
126
+                    JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
126 127
                     permissionsReplyListener);
127 128
                 APP.conference.removeConferenceListener(
128
-                    ConferenceEvents.USER_LEFT,
129
+                    JitsiConferenceEvents.USER_LEFT,
129 130
                     onUserLeft);
130 131
             };
131 132
 
@@ -156,9 +157,10 @@ export default class Controller extends RemoteControlParticipant {
156 157
             };
157 158
 
158 159
             APP.conference.addConferenceListener(
159
-                ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
160
+                JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
160 161
                 permissionsReplyListener);
161
-            APP.conference.addConferenceListener(ConferenceEvents.USER_LEFT,
162
+            APP.conference.addConferenceListener(
163
+                JitsiConferenceEvents.USER_LEFT,
162 164
                 onUserLeft);
163 165
             this._requestedParticipant = userId;
164 166
             this.sendRemoteControlEndpointMessage(userId, {
@@ -240,9 +242,9 @@ export default class Controller extends RemoteControlParticipant {
240 242
         APP.UI.addListener(UIEvents.LARGE_VIDEO_ID_CHANGED,
241 243
             this._largeVideoChangedListener);
242 244
         APP.conference.addConferenceListener(
243
-            ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
245
+            JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
244 246
             this._stopListener);
245
-        APP.conference.addConferenceListener(ConferenceEvents.USER_LEFT,
247
+        APP.conference.addConferenceListener(JitsiConferenceEvents.USER_LEFT,
246 248
             this._userLeftListener);
247 249
         this.resume();
248 250
     }
@@ -325,9 +327,9 @@ export default class Controller extends RemoteControlParticipant {
325 327
         APP.UI.removeListener(UIEvents.LARGE_VIDEO_ID_CHANGED,
326 328
             this._largeVideoChangedListener);
327 329
         APP.conference.removeConferenceListener(
328
-            ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
330
+            JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
329 331
             this._stopListener);
330
-        APP.conference.removeConferenceListener(ConferenceEvents.USER_LEFT,
332
+        APP.conference.removeConferenceListener(JitsiConferenceEvents.USER_LEFT,
331 333
             this._userLeftListener);
332 334
         this.pause();
333 335
         this._controlledParticipant = null;

+ 9
- 7
modules/remotecontrol/Receiver.js 查看文件

@@ -3,6 +3,9 @@
3 3
 import { getLogger } from 'jitsi-meet-logger';
4 4
 
5 5
 import * as JitsiMeetConferenceEvents from '../../ConferenceEvents';
6
+import {
7
+    JitsiConferenceEvents
8
+} from '../../react/features/base/lib-jitsi-meet';
6 9
 import {
7 10
     openRemoteControlAuthorizationDialog
8 11
 } from '../../react/features/remote-control';
@@ -22,9 +25,7 @@ import RemoteControlParticipant from './RemoteControlParticipant';
22 25
 declare var APP: Object;
23 26
 declare var config: Object;
24 27
 declare var interfaceConfig: Object;
25
-declare var JitsiMeetJS: Object;
26 28
 
27
-const ConferenceEvents = JitsiMeetJS.events.conference;
28 29
 const logger = getLogger(__filename);
29 30
 
30 31
 /**
@@ -92,7 +93,7 @@ export default class Receiver extends RemoteControlParticipant {
92 93
             // Announce remote control support.
93 94
             APP.connection.addFeature(DISCO_REMOTE_CONTROL_FEATURE, true);
94 95
             APP.conference.addConferenceListener(
95
-                ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
96
+                JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
96 97
                 this._remoteControlEventsListener);
97 98
             APP.conference.addListener(JitsiMeetConferenceEvents.BEFORE_HANGUP,
98 99
                 this._hangupListener);
@@ -101,7 +102,7 @@ export default class Receiver extends RemoteControlParticipant {
101 102
             this._stop(true);
102 103
             APP.connection.removeFeature(DISCO_REMOTE_CONTROL_FEATURE);
103 104
             APP.conference.removeConferenceListener(
104
-                ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
105
+                JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
105 106
                 this._remoteControlEventsListener);
106 107
             APP.conference.removeListener(
107 108
                 JitsiMeetConferenceEvents.BEFORE_HANGUP,
@@ -110,7 +111,7 @@ export default class Receiver extends RemoteControlParticipant {
110 111
     }
111 112
 
112 113
     /**
113
-     * Removes the listener for ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED
114
+     * Removes the listener for JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED
114 115
      * events. Sends stop message to the wrapper application. Optionally
115 116
      * displays dialog for informing the user that remote control session
116 117
      * ended.
@@ -125,7 +126,8 @@ export default class Receiver extends RemoteControlParticipant {
125 126
         }
126 127
         logger.log('Remote control receiver stop.');
127 128
         this._controller = null;
128
-        APP.conference.removeConferenceListener(ConferenceEvents.USER_LEFT,
129
+        APP.conference.removeConferenceListener(
130
+            JitsiConferenceEvents.USER_LEFT,
129 131
             this._userLeftListener);
130 132
         transport.sendEvent({
131 133
             name: REMOTE_CONTROL_MESSAGE_NAME,
@@ -216,7 +218,7 @@ export default class Receiver extends RemoteControlParticipant {
216 218
      * @returns {void}
217 219
      */
218 220
     grant(userId: string) {
219
-        APP.conference.addConferenceListener(ConferenceEvents.USER_LEFT,
221
+        APP.conference.addConferenceListener(JitsiConferenceEvents.USER_LEFT,
220 222
             this._userLeftListener);
221 223
         this._controller = userId;
222 224
         logger.log(`Remote control permissions granted to: ${userId}`);

+ 4
- 0
react/features/base/lib-jitsi-meet/index.js 查看文件

@@ -10,8 +10,12 @@ export const JitsiConferenceErrors = JitsiMeetJS.errors.conference;
10 10
 export const JitsiConferenceEvents = JitsiMeetJS.events.conference;
11 11
 export const JitsiConnectionErrors = JitsiMeetJS.errors.connection;
12 12
 export const JitsiConnectionEvents = JitsiMeetJS.events.connection;
13
+export const JitsiConnectionQualityEvents
14
+    = JitsiMeetJS.events.connectionQuality;
15
+export const JitsiMediaDevicesEvents = JitsiMeetJS.events.mediaDevices;
13 16
 export const JitsiParticipantConnectionStatus
14 17
     = JitsiMeetJS.constants.participantConnectionStatus;
18
+export const JitsiRecordingStatus = JitsiMeetJS.constants.recordingStatus;
15 19
 export const JitsiTrackErrors = JitsiMeetJS.errors.track;
16 20
 export const JitsiTrackEvents = JitsiMeetJS.events.track;
17 21
 

+ 3
- 5
react/features/connection-indicator/statsEmitter.js 查看文件

@@ -2,7 +2,7 @@
2 2
 
3 3
 import _ from 'lodash';
4 4
 
5
-import JitsiMeetJS from '../base/lib-jitsi-meet';
5
+import { JitsiConnectionQualityEvents } from '../base/lib-jitsi-meet';
6 6
 
7 7
 declare var APP: Object;
8 8
 
@@ -28,12 +28,10 @@ const statsEmitter = {
28 28
      * @returns {void}
29 29
      */
30 30
     startListeningForStats(conference: Object) {
31
-        const { connectionQuality } = JitsiMeetJS.events;
32
-
33
-        conference.on(connectionQuality.LOCAL_STATS_UPDATED,
31
+        conference.on(JitsiConnectionQualityEvents.LOCAL_STATS_UPDATED,
34 32
             stats => this._onStatsUpdated(conference.myUserId(), stats));
35 33
 
36
-        conference.on(connectionQuality.REMOTE_STATS_UPDATED,
34
+        conference.on(JitsiConnectionQualityEvents.REMOTE_STATS_UPDATED,
37 35
             (id, stats) => this._emitStatsUpdate(id, stats));
38 36
     },
39 37
 

Loading…
取消
儲存