|
|
@@ -794,6 +794,7 @@ class RTCUtils extends Listenable {
|
|
794
|
794
|
RTCBrowserType.isNWJS() ||
|
|
795
|
795
|
RTCBrowserType.isElectron() ||
|
|
796
|
796
|
RTCBrowserType.isReactNative()) {
|
|
|
797
|
+
|
|
797
|
798
|
this.peerconnection = webkitRTCPeerConnection;
|
|
798
|
799
|
var getUserMedia = navigator.webkitGetUserMedia.bind(navigator);
|
|
799
|
800
|
if (navigator.mediaDevices) {
|
|
|
@@ -853,16 +854,11 @@ class RTCUtils extends Listenable {
|
|
853
|
854
|
}
|
|
854
|
855
|
// Detect IE/Safari
|
|
855
|
856
|
else if (RTCBrowserType.isTemasysPluginUsed()) {
|
|
856
|
|
-
|
|
857
|
|
- //AdapterJS.WebRTCPlugin.setLogLevel(
|
|
858
|
|
- // AdapterJS.WebRTCPlugin.PLUGIN_LOG_LEVELS.VERBOSE);
|
|
859
|
|
- var self = this;
|
|
860
|
|
- AdapterJS.webRTCReady(function () {
|
|
861
|
|
-
|
|
862
|
|
- self.peerconnection = RTCPeerConnection;
|
|
863
|
|
- self.getUserMedia = window.getUserMedia;
|
|
864
|
|
- self.enumerateDevices = enumerateDevicesThroughMediaStreamTrack;
|
|
865
|
|
- self.attachMediaStream = wrapAttachMediaStream(function (element, stream) {
|
|
|
857
|
+ const webRTCReadyCb = () => {
|
|
|
858
|
+ this.peerconnection = RTCPeerConnection;
|
|
|
859
|
+ this.getUserMedia = window.getUserMedia;
|
|
|
860
|
+ this.enumerateDevices = enumerateDevicesThroughMediaStreamTrack;
|
|
|
861
|
+ this.attachMediaStream = wrapAttachMediaStream((element, stream) => {
|
|
866
|
862
|
if (stream) {
|
|
867
|
863
|
if (stream.id === "dummyAudio"
|
|
868
|
864
|
|| stream.id === "dummyVideo") {
|
|
|
@@ -886,14 +882,37 @@ class RTCUtils extends Listenable {
|
|
886
|
882
|
|
|
887
|
883
|
return attachMediaStream(element, stream);
|
|
888
|
884
|
});
|
|
889
|
|
- self.getStreamID = function (stream) {
|
|
890
|
|
- return SDPUtil.filter_special_chars(stream.label);
|
|
891
|
|
- };
|
|
|
885
|
+ this.getStreamID
|
|
|
886
|
+ = stream => SDPUtil.filter_special_chars(stream.label);
|
|
892
|
887
|
|
|
893
|
|
- onReady(options,
|
|
894
|
|
- self.getUserMediaWithConstraints.bind(self));
|
|
895
|
|
- resolve();
|
|
896
|
|
- });
|
|
|
888
|
+ onReady(
|
|
|
889
|
+ options,
|
|
|
890
|
+ this.getUserMediaWithConstraints.bind(this));
|
|
|
891
|
+ };
|
|
|
892
|
+ const webRTCReadyPromise
|
|
|
893
|
+ = new Promise(resolve => AdapterJS.webRTCReady(resolve));
|
|
|
894
|
+
|
|
|
895
|
+ // Resolve or reject depending on whether the Temasys plugin is
|
|
|
896
|
+ // installed.
|
|
|
897
|
+ AdapterJS.WebRTCPlugin.isPluginInstalled(
|
|
|
898
|
+ AdapterJS.WebRTCPlugin.pluginInfo.prefix,
|
|
|
899
|
+ AdapterJS.WebRTCPlugin.pluginInfo.plugName,
|
|
|
900
|
+ AdapterJS.WebRTCPlugin.pluginInfo.type,
|
|
|
901
|
+ /* installed */ () => {
|
|
|
902
|
+ webRTCReadyPromise.then(() => {
|
|
|
903
|
+ webRTCReadyCb();
|
|
|
904
|
+ resolve();
|
|
|
905
|
+ });
|
|
|
906
|
+ },
|
|
|
907
|
+ /* not installed */ () => {
|
|
|
908
|
+ const error
|
|
|
909
|
+ = new Error('Temasys plugin is not installed');
|
|
|
910
|
+
|
|
|
911
|
+ error.name = 'WEBRTC_NOT_READY';
|
|
|
912
|
+ error.webRTCReadyPromise = webRTCReadyPromise;
|
|
|
913
|
+
|
|
|
914
|
+ reject(error);
|
|
|
915
|
+ });
|
|
897
|
916
|
} else {
|
|
898
|
917
|
rejectWithWebRTCNotSupported(
|
|
899
|
918
|
'Browser does not appear to be WebRTC-capable',
|