Преглед изворни кода

Merge pull request #224 from jitsi/detect_nwjs_ss_cancel

Implements detection for cancel on the SS pickup window
dev1
Дамян Минков пре 9 година
родитељ
комит
e4d704cf73
1 измењених фајлова са 26 додато и 2 уклоњено
  1. 26
    2
      modules/RTC/ScreenObtainer.js

+ 26
- 2
modules/RTC/ScreenObtainer.js Прегледај датотеку

84
             obtainDesktopStream = function (options, onSuccess, onFailure) {
84
             obtainDesktopStream = function (options, onSuccess, onFailure) {
85
                 window.JitsiMeetNW.obtainDesktopStream (
85
                 window.JitsiMeetNW.obtainDesktopStream (
86
                     onSuccess, function (error, constraints) {
86
                     onSuccess, function (error, constraints) {
87
-                        onFailure && onFailure(new JitsiTrackError(
88
-                            error, constraints, ["desktop"]));
87
+                        var jitsiError;
88
+                        // FIXME:
89
+                        // This is very very durty fix for recognising that the
90
+                        // user have clicked the cancel button from the Desktop
91
+                        // sharing pick window. The proper solution would be to
92
+                        // detect this in the NWJS application by checking the
93
+                        // streamId === "". Even better solution would be to
94
+                        // stop calling GUM from the NWJS app and just pass the
95
+                        // streamId to lib-jitsi-meet. This way the desktop
96
+                        // sharing implementation for NWJS and chrome extension
97
+                        // will be the same and lib-jitsi-meet will be able to
98
+                        // control the constraints, check the streamId, etc.
99
+                        //
100
+                        // I cannot find documentation about "InvalidStateError"
101
+                        // but this is what we are receiving from GUM when the
102
+                        // streamId for the desktop sharing is "".
103
+                        if (error && error.name == "InvalidStateError") {
104
+                            jitsiError = new JitsiTrackError(
105
+                                JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED
106
+                            );
107
+                        } else {
108
+                            jitsiError = new JitsiTrackError(
109
+                                error, constraints, ["desktop"]);
110
+                        }
111
+                        (typeof(onFailure) === "function") &&
112
+                            onFailure(jitsiError);
89
                     });
113
                     });
90
             };
114
             };
91
         } else if (RTCBrowserType.isTemasysPluginUsed()) {
115
         } else if (RTCBrowserType.isTemasysPluginUsed()) {

Loading…
Откажи
Сачувај