Quellcode durchsuchen

Changes after code review

tags/v0.0.2
tsareg vor 9 Jahren
Ursprung
Commit
e2860d55bf
1 geänderte Dateien mit 15 neuen und 13 gelöschten Zeilen
  1. 15
    13
      modules/RTC/RTCUtils.js

+ 15
- 13
modules/RTC/RTCUtils.js Datei anzeigen

@@ -109,15 +109,24 @@ function setResolutionConstraints(constraints, resolution) {
109 109
 function getConstraints(um, options) {
110 110
     var constraints = {audio: false, video: false};
111 111
 
112
+    // Don't mix new and old style settings for Chromium as this leads
113
+    // to TypeError in new Chromium versions. @see
114
+    // https://bugs.chromium.org/p/chromium/issues/detail?id=614716
115
+    // This is a temporary solution, in future we will fully split old and
116
+    // new style constraints when new versions of Chromium and Firefox will
117
+    // have stable support of new constraints format. For more information
118
+    // @see https://github.com/jitsi/lib-jitsi-meet/pull/136
119
+    var isNewStyleConstraintsSupported =
120
+        RTCBrowserType.isFirefox() ||
121
+        RTCBrowserType.isReactNative() ||
122
+        RTCBrowserType.isTemasysPluginUsed();
123
+
112 124
     if (um.indexOf('video') >= 0) {
113 125
         // same behaviour as true
114 126
         constraints.video = { mandatory: {}, optional: [] };
115 127
 
116 128
         if (options.cameraDeviceId) {
117
-            // Don't mix new and old style settings for Chromium as this leads
118
-            // to TypeError in new Chromium versions. @see
119
-            // https://bugs.chromium.org/p/chromium/issues/detail?id=614716
120
-            if (!RTCBrowserType.isChrome() && !RTCBrowserType.isOpera()) {
129
+            if (isNewStyleConstraintsSupported) {
121 130
                 // New style of setting device id.
122 131
                 constraints.video.deviceId = options.cameraDeviceId;
123 132
             }
@@ -131,11 +140,7 @@ function getConstraints(um, options) {
131 140
             // TODO: Maybe use "exact" syntax if options.facingMode is defined,
132 141
             // but this probably needs to be decided when updating other
133 142
             // constraints, as we currently don't use "exact" syntax anywhere.
134
-
135
-            // Don't mix new and old style settings for Chromium as this leads
136
-            // to TypeError in new Chromium versions. @see
137
-            // https://bugs.chromium.org/p/chromium/issues/detail?id=614716
138
-            if (!RTCBrowserType.isChrome() && !RTCBrowserType.isOpera()) {
143
+            if (isNewStyleConstraintsSupported) {
139 144
                 constraints.video.facingMode = options.facingMode || 'user';
140 145
             }
141 146
 
@@ -157,10 +162,7 @@ function getConstraints(um, options) {
157 162
             // same behaviour as true
158 163
             constraints.audio = { mandatory: {}, optional: []};
159 164
             if (options.micDeviceId) {
160
-                // Don't mix new and old style settings for Chromium as this
161
-                // leads to TypeError in new Chromium versions. @see
162
-                // https://bugs.chromium.org/p/chromium/issues/detail?id=614716
163
-                if (!RTCBrowserType.isChrome() && !RTCBrowserType.isOpera()) {
165
+                if (isNewStyleConstraintsSupported) {
164 166
                     // New style of setting device id.
165 167
                     constraints.audio.deviceId = options.micDeviceId;
166 168
                 }

Laden…
Abbrechen
Speichern