|
|
@@ -748,11 +748,11 @@ class RTCUtils extends Listenable {
|
|
748
|
748
|
if (RTCBrowserType.isFirefox()) {
|
|
749
|
749
|
var FFversion = RTCBrowserType.getFirefoxVersion();
|
|
750
|
750
|
if (FFversion < 40) {
|
|
751
|
|
- logger.error(
|
|
752
|
|
- "Firefox version too old: " + FFversion +
|
|
753
|
|
- ". Required >= 40.");
|
|
754
|
|
- reject(new Error("Firefox version too old: " + FFversion +
|
|
755
|
|
- ". Required >= 40."));
|
|
|
751
|
+ rejectWithWebRTCNotSupported(
|
|
|
752
|
+ `Firefox version too old: ${FFversion}.`
|
|
|
753
|
+ + ' Required >= 40.',
|
|
|
754
|
+ reject);
|
|
|
755
|
+
|
|
756
|
756
|
return;
|
|
757
|
757
|
}
|
|
758
|
758
|
this.peerconnection = mozRTCPeerConnection;
|
|
|
@@ -895,9 +895,10 @@ class RTCUtils extends Listenable {
|
|
895
|
895
|
resolve();
|
|
896
|
896
|
});
|
|
897
|
897
|
} else {
|
|
898
|
|
- var errmsg = 'Browser does not appear to be WebRTC-capable';
|
|
899
|
|
- logger.error(errmsg);
|
|
900
|
|
- reject(new Error(errmsg));
|
|
|
898
|
+ rejectWithWebRTCNotSupported(
|
|
|
899
|
+ 'Browser does not appear to be WebRTC-capable',
|
|
|
900
|
+ reject);
|
|
|
901
|
+
|
|
901
|
902
|
return;
|
|
902
|
903
|
}
|
|
903
|
904
|
|
|
|
@@ -1292,6 +1293,32 @@ class RTCUtils extends Listenable {
|
|
1292
|
1293
|
}
|
|
1293
|
1294
|
}
|
|
1294
|
1295
|
|
|
|
1296
|
+/**
|
|
|
1297
|
+ * Rejects a Promise because WebRTC is not supported.
|
|
|
1298
|
+ *
|
|
|
1299
|
+ * @param {string} errorMessage - The human-readable message of the Error which
|
|
|
1300
|
+ * is the reason for the rejection.
|
|
|
1301
|
+ * @param {Function} reject - The reject function of the Promise.
|
|
|
1302
|
+ * @returns {void}
|
|
|
1303
|
+ */
|
|
|
1304
|
+function rejectWithWebRTCNotSupported(errorMessage, reject) {
|
|
|
1305
|
+ const error = new Error(errorMessage);
|
|
|
1306
|
+
|
|
|
1307
|
+ // WebRTC is not supported either natively or via a known plugin such as
|
|
|
1308
|
+ // Temasys.
|
|
|
1309
|
+ // XXX The Error class already has a property name which is commonly used to
|
|
|
1310
|
+ // detail the represented error in a non-human-readable way (in contrast to
|
|
|
1311
|
+ // the human-readable property message). I explicitly did not want to
|
|
|
1312
|
+ // introduce a new specific property.
|
|
|
1313
|
+ // FIXME None of the existing JitsiXXXErrors seemed to be appropriate
|
|
|
1314
|
+ // recipients of the constant WEBRTC_NOT_SUPPORTED so I explicitly chose to
|
|
|
1315
|
+ // leave it as a magic string at the time of this writing.
|
|
|
1316
|
+ error.name = 'WEBRTC_NOT_SUPPORTED';
|
|
|
1317
|
+
|
|
|
1318
|
+ logger.error(errorMessage);
|
|
|
1319
|
+ reject(error);
|
|
|
1320
|
+}
|
|
|
1321
|
+
|
|
1295
|
1322
|
const rtcUtils = new RTCUtils();
|
|
1296
|
1323
|
|
|
1297
|
1324
|
export default rtcUtils;
|