Просмотр исходного кода

Merge pull request #132 from tsareg/pass_facing_mode_through_create_local_tracks_options

Add ability to pass facingMode as option to JitsiMeetJS.createLocalTracks()
master
Любомир Маринов 9 лет назад
Родитель
Сommit
6f05b6ee64
2 измененных файлов: 6 добавлений и 1 удалений
  1. 1
    0
      doc/API.md
  2. 5
    1
      modules/RTC/RTCUtils.js

+ 1
- 0
doc/API.md Просмотреть файл

@@ -66,6 +66,7 @@ JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
66 66
         4. micDeviceId - the deviceID for the audio device that is going to be used
67 67
         5. minFps - the minimum frame rate for the video stream (passed to GUM)
68 68
         6. maxFps - the maximum frame rate for the video stream (passed to GUM)
69
+        7. facingMode - facing mode for a camera (possible values - 'user', 'environment')
69 70
 
70 71
 * ```JitsiMeetJS.enumerateDevices(callback)``` - __DEPRECATED__. Use ```JitsiMeetJS.mediaDevices.enumerateDevices(callback)``` instead.
71 72
 * ```JitsiMeetJS.isDeviceListAvailable()``` - __DEPRECATED__. Use ```JitsiMeetJS.mediaDevices.isDeviceListAvailable()``` instead.

+ 5
- 1
modules/RTC/RTCUtils.js Просмотреть файл

@@ -103,6 +103,7 @@ function setResolutionConstraints(constraints, resolution) {
103 103
  * @param {string} options.desktopStream
104 104
  * @param {string} options.cameraDeviceId
105 105
  * @param {string} options.micDeviceId
106
+ * @param {'user'|'environment'} options.facingMode
106 107
  * @param {bool} firefox_fake_device
107 108
  */
108 109
 function getConstraints(um, options) {
@@ -122,7 +123,10 @@ function getConstraints(um, options) {
122 123
         } else {
123 124
             // Prefer the front i.e. user-facing camera (to the back i.e.
124 125
             // environment-facing camera, for example).
125
-            constraints.video.facingMode = 'user';
126
+            // TODO: Maybe use "exact" syntax if options.facingMode is defined,
127
+            // but this probably needs to be decided when updating other
128
+            // constraints, as we currently don't use "exact" syntax anywhere.
129
+            constraints.video.facingMode = options.facingMode || 'user';
126 130
         }
127 131
 
128 132
         constraints.video.optional.push({ googLeakyBucket: true });

Загрузка…
Отмена
Сохранить