|
|
@@ -107,29 +107,6 @@ function emptyFuncton() {
|
|
107
|
107
|
// no-op
|
|
108
|
108
|
}
|
|
109
|
109
|
|
|
110
|
|
-/**
|
|
111
|
|
- * Initialize wrapper function for enumerating devices.
|
|
112
|
|
- * TODO: remove this, it should no longer be needed.
|
|
113
|
|
- *
|
|
114
|
|
- * @returns {?Function}
|
|
115
|
|
- */
|
|
116
|
|
-function initEnumerateDevicesWithCallback() {
|
|
117
|
|
- if (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) {
|
|
118
|
|
- return callback => {
|
|
119
|
|
- navigator.mediaDevices.enumerateDevices()
|
|
120
|
|
- .then(devices => {
|
|
121
|
|
- updateKnownDevices(devices);
|
|
122
|
|
- callback(devices);
|
|
123
|
|
- })
|
|
124
|
|
- .catch(error => {
|
|
125
|
|
- logger.warn(`Failed to enumerate devices. ${error}`);
|
|
126
|
|
- updateKnownDevices([]);
|
|
127
|
|
- callback([]);
|
|
128
|
|
- });
|
|
129
|
|
- };
|
|
130
|
|
- }
|
|
131
|
|
-}
|
|
132
|
|
-
|
|
133
|
110
|
/**
|
|
134
|
111
|
*
|
|
135
|
112
|
* @param constraints
|
|
|
@@ -804,8 +781,6 @@ class RTCUtils extends Listenable {
|
|
804
|
781
|
window.clearInterval(availableDevicesPollTimer);
|
|
805
|
782
|
availableDevicesPollTimer = undefined;
|
|
806
|
783
|
|
|
807
|
|
- this.enumerateDevices = initEnumerateDevicesWithCallback();
|
|
808
|
|
-
|
|
809
|
784
|
if (browser.usesNewGumFlow()) {
|
|
810
|
785
|
this.RTCPeerConnectionType = RTCPeerConnection;
|
|
811
|
786
|
|
|
|
@@ -898,6 +873,24 @@ class RTCUtils extends Listenable {
|
|
898
|
873
|
this.p2pPcConstraints = this.p2pPcConstraints || this.pcConstraints;
|
|
899
|
874
|
}
|
|
900
|
875
|
|
|
|
876
|
+
|
|
|
877
|
+ /**
|
|
|
878
|
+ *
|
|
|
879
|
+ * @param {Function} callback
|
|
|
880
|
+ */
|
|
|
881
|
+ enumerateDevices(callback) {
|
|
|
882
|
+ navigator.mediaDevices.enumerateDevices()
|
|
|
883
|
+ .then(devices => {
|
|
|
884
|
+ updateKnownDevices(devices);
|
|
|
885
|
+ callback(devices);
|
|
|
886
|
+ })
|
|
|
887
|
+ .catch(error => {
|
|
|
888
|
+ logger.warn(`Failed to enumerate devices. ${error}`);
|
|
|
889
|
+ updateKnownDevices([]);
|
|
|
890
|
+ callback([]);
|
|
|
891
|
+ });
|
|
|
892
|
+ }
|
|
|
893
|
+
|
|
901
|
894
|
/* eslint-disable max-params */
|
|
902
|
895
|
|
|
903
|
896
|
/**
|