|
|
@@ -1400,6 +1400,8 @@ export default {
|
|
1400
|
1400
|
receiver.stop();
|
|
1401
|
1401
|
}
|
|
1402
|
1402
|
|
|
|
1403
|
+ this._stopProxyConnection();
|
|
|
1404
|
+
|
|
1403
|
1405
|
let promise = null;
|
|
1404
|
1406
|
|
|
1405
|
1407
|
if (didHaveVideo) {
|
|
|
@@ -1475,9 +1477,12 @@ export default {
|
|
1475
|
1477
|
|
|
1476
|
1478
|
/**
|
|
1477
|
1479
|
* Creates desktop (screensharing) {@link JitsiLocalTrack}
|
|
|
1480
|
+ *
|
|
1478
|
1481
|
* @param {Object} [options] - Screen sharing options that will be passed to
|
|
1479
|
1482
|
* createLocalTracks.
|
|
1480
|
|
- *
|
|
|
1483
|
+ * @param {Object} [options.desktopSharing]
|
|
|
1484
|
+ * @param {Object} [options.desktopStream] - An existing desktop stream to
|
|
|
1485
|
+ * use instead of creating a new desktop stream.
|
|
1481
|
1486
|
* @return {Promise.<JitsiLocalTrack>} - A Promise resolved with
|
|
1482
|
1487
|
* {@link JitsiLocalTrack} for the screensharing or rejected with
|
|
1483
|
1488
|
* {@link JitsiTrackError}.
|
|
|
@@ -1490,49 +1495,52 @@ export default {
|
|
1490
|
1495
|
const didHaveVideo = Boolean(this.localVideo);
|
|
1491
|
1496
|
const wasVideoMuted = this.isLocalVideoMuted();
|
|
1492
|
1497
|
|
|
1493
|
|
- return createLocalTracksF({
|
|
1494
|
|
- desktopSharingSourceDevice: options.desktopSharingSources
|
|
1495
|
|
- ? null : config._desktopSharingSourceDevice,
|
|
1496
|
|
- desktopSharingSources: options.desktopSharingSources,
|
|
1497
|
|
- devices: [ 'desktop' ],
|
|
1498
|
|
- desktopSharingExtensionExternalInstallation: {
|
|
1499
|
|
- interval: 500,
|
|
1500
|
|
- checkAgain: () => DSExternalInstallationInProgress,
|
|
1501
|
|
- listener: (status, url) => {
|
|
1502
|
|
- switch (status) {
|
|
1503
|
|
- case 'waitingForExtension': {
|
|
1504
|
|
- DSExternalInstallationInProgress = true;
|
|
1505
|
|
- externalInstallation = true;
|
|
1506
|
|
- const listener = () => {
|
|
1507
|
|
- // Wait a little bit more just to be sure that we
|
|
1508
|
|
- // won't miss the extension installation
|
|
1509
|
|
- setTimeout(
|
|
1510
|
|
- () => {
|
|
|
1498
|
+ const getDesktopStreamPromise = options.desktopStream
|
|
|
1499
|
+ ? Promise.resolve([ options.desktopStream ])
|
|
|
1500
|
+ : createLocalTracksF({
|
|
|
1501
|
+ desktopSharingSourceDevice: options.desktopSharingSources
|
|
|
1502
|
+ ? null : config._desktopSharingSourceDevice,
|
|
|
1503
|
+ desktopSharingSources: options.desktopSharingSources,
|
|
|
1504
|
+ devices: [ 'desktop' ],
|
|
|
1505
|
+ desktopSharingExtensionExternalInstallation: {
|
|
|
1506
|
+ interval: 500,
|
|
|
1507
|
+ checkAgain: () => DSExternalInstallationInProgress,
|
|
|
1508
|
+ listener: (status, url) => {
|
|
|
1509
|
+ switch (status) {
|
|
|
1510
|
+ case 'waitingForExtension': {
|
|
|
1511
|
+ DSExternalInstallationInProgress = true;
|
|
|
1512
|
+ externalInstallation = true;
|
|
|
1513
|
+ const listener = () => {
|
|
|
1514
|
+ // Wait a little bit more just to be sure that
|
|
|
1515
|
+ // we won't miss the extension installation
|
|
|
1516
|
+ setTimeout(() => {
|
|
1511
|
1517
|
DSExternalInstallationInProgress = false;
|
|
1512
|
1518
|
},
|
|
1513
|
1519
|
500);
|
|
1514
|
|
- APP.UI.removeListener(
|
|
|
1520
|
+ APP.UI.removeListener(
|
|
|
1521
|
+ UIEvents.EXTERNAL_INSTALLATION_CANCELED,
|
|
|
1522
|
+ listener);
|
|
|
1523
|
+ };
|
|
|
1524
|
+
|
|
|
1525
|
+ APP.UI.addListener(
|
|
1515
|
1526
|
UIEvents.EXTERNAL_INSTALLATION_CANCELED,
|
|
1516
|
1527
|
listener);
|
|
1517
|
|
- };
|
|
1518
|
|
-
|
|
1519
|
|
- APP.UI.addListener(
|
|
1520
|
|
- UIEvents.EXTERNAL_INSTALLATION_CANCELED,
|
|
1521
|
|
- listener);
|
|
1522
|
|
- APP.UI.showExtensionExternalInstallationDialog(url);
|
|
1523
|
|
- break;
|
|
1524
|
|
- }
|
|
1525
|
|
- case 'extensionFound':
|
|
1526
|
|
- // Close the dialog.
|
|
1527
|
|
- externalInstallation && $.prompt.close();
|
|
1528
|
|
- break;
|
|
1529
|
|
- default:
|
|
|
1528
|
+ APP.UI.showExtensionExternalInstallationDialog(url);
|
|
|
1529
|
+ break;
|
|
|
1530
|
+ }
|
|
|
1531
|
+ case 'extensionFound':
|
|
|
1532
|
+ // Close the dialog.
|
|
|
1533
|
+ externalInstallation && $.prompt.close();
|
|
|
1534
|
+ break;
|
|
|
1535
|
+ default:
|
|
1530
|
1536
|
|
|
1531
|
|
- // Unknown status
|
|
|
1537
|
+ // Unknown status
|
|
|
1538
|
+ }
|
|
1532
|
1539
|
}
|
|
1533
|
1540
|
}
|
|
1534
|
|
- }
|
|
1535
|
|
- }).then(([ desktopStream ]) => {
|
|
|
1541
|
+ });
|
|
|
1542
|
+
|
|
|
1543
|
+ return getDesktopStreamPromise.then(([ desktopStream ]) => {
|
|
1536
|
1544
|
// Stores the "untoggle" handler which remembers whether was
|
|
1537
|
1545
|
// there any video before and whether was it muted.
|
|
1538
|
1546
|
this._untoggleScreenSharing
|
|
|
@@ -2477,6 +2485,8 @@ export default {
|
|
2477
|
2485
|
hangup(requestFeedback = false) {
|
|
2478
|
2486
|
eventEmitter.emit(JitsiMeetConferenceEvents.BEFORE_HANGUP);
|
|
2479
|
2487
|
|
|
|
2488
|
+ this._stopProxyConnection();
|
|
|
2489
|
+
|
|
2480
|
2490
|
APP.store.dispatch(destroyLocalTracks());
|
|
2481
|
2491
|
this._localTracksInitialized = false;
|
|
2482
|
2492
|
this.localVideo = null;
|
|
|
@@ -2694,6 +2704,65 @@ export default {
|
|
2694
|
2704
|
return this.localVideo.sourceType;
|
|
2695
|
2705
|
},
|
|
2696
|
2706
|
|
|
|
2707
|
+ /**
|
|
|
2708
|
+ * Callback invoked by the external api create or update a direct connection
|
|
|
2709
|
+ * from the local client to an external client.
|
|
|
2710
|
+ *
|
|
|
2711
|
+ * @param {Object} event - The object containing information that should be
|
|
|
2712
|
+ * passed to the {@code ProxyConnectionService}.
|
|
|
2713
|
+ * @returns {void}
|
|
|
2714
|
+ */
|
|
|
2715
|
+ onProxyConnectionEvent(event) {
|
|
|
2716
|
+ if (!this._proxyConnection) {
|
|
|
2717
|
+ this._proxyConnection = new JitsiMeetJS.ProxyConnectionService({
|
|
|
2718
|
+ /**
|
|
|
2719
|
+ * The proxy connection feature is currently tailored towards
|
|
|
2720
|
+ * taking a proxied video stream and showing it as a local
|
|
|
2721
|
+ * desktop screen.
|
|
|
2722
|
+ */
|
|
|
2723
|
+ convertVideoToDesktop: true,
|
|
|
2724
|
+
|
|
|
2725
|
+ /**
|
|
|
2726
|
+ * Callback invoked to pass messages from the local client back
|
|
|
2727
|
+ * out to the external client.
|
|
|
2728
|
+ *
|
|
|
2729
|
+ * @param {string} peerJid - The jid of the intended recipient
|
|
|
2730
|
+ * of the message.
|
|
|
2731
|
+ * @param {Object} data - The message that should be sent. For
|
|
|
2732
|
+ * screensharing this is an iq.
|
|
|
2733
|
+ * @returns {void}
|
|
|
2734
|
+ */
|
|
|
2735
|
+ onSendMessage: (peerJid, data) =>
|
|
|
2736
|
+ APP.API.sendProxyConnectionEvent({
|
|
|
2737
|
+ data,
|
|
|
2738
|
+ to: peerJid
|
|
|
2739
|
+ }),
|
|
|
2740
|
+
|
|
|
2741
|
+ /**
|
|
|
2742
|
+ * Callback invoked when the remote peer of the proxy connection
|
|
|
2743
|
+ * has provided a video stream, intended to be used as a local
|
|
|
2744
|
+ * desktop stream.
|
|
|
2745
|
+ *
|
|
|
2746
|
+ * @param {JitsiLocalTrack} remoteProxyStream - The media
|
|
|
2747
|
+ * stream to use as a local desktop stream.
|
|
|
2748
|
+ * @returns {void}
|
|
|
2749
|
+ */
|
|
|
2750
|
+ onRemoteStream: desktopStream => {
|
|
|
2751
|
+ if (desktopStream.videoType !== 'desktop') {
|
|
|
2752
|
+ logger.warn('Received a non-desktop stream to proxy.');
|
|
|
2753
|
+ desktopStream.dispose();
|
|
|
2754
|
+
|
|
|
2755
|
+ return;
|
|
|
2756
|
+ }
|
|
|
2757
|
+
|
|
|
2758
|
+ this.toggleScreenSharing(undefined, { desktopStream });
|
|
|
2759
|
+ }
|
|
|
2760
|
+ });
|
|
|
2761
|
+ }
|
|
|
2762
|
+
|
|
|
2763
|
+ this._proxyConnection.processMessage(event);
|
|
|
2764
|
+ },
|
|
|
2765
|
+
|
|
2697
|
2766
|
/**
|
|
2698
|
2767
|
* Sets the video muted status.
|
|
2699
|
2768
|
*
|
|
|
@@ -2728,5 +2797,19 @@ export default {
|
|
2728
|
2797
|
if (score === -1 || (score >= 1 && score <= 5)) {
|
|
2729
|
2798
|
APP.store.dispatch(submitFeedback(score, message, room));
|
|
2730
|
2799
|
}
|
|
|
2800
|
+ },
|
|
|
2801
|
+
|
|
|
2802
|
+ /**
|
|
|
2803
|
+ * Terminates any proxy screensharing connection that is active.
|
|
|
2804
|
+ *
|
|
|
2805
|
+ * @private
|
|
|
2806
|
+ * @returns {void}
|
|
|
2807
|
+ */
|
|
|
2808
|
+ _stopProxyConnection() {
|
|
|
2809
|
+ if (this._proxyConnection) {
|
|
|
2810
|
+ this._proxyConnection.stop();
|
|
|
2811
|
+ }
|
|
|
2812
|
+
|
|
|
2813
|
+ this._proxyConnection = null;
|
|
2731
|
2814
|
}
|
|
2732
|
2815
|
};
|