@reactoo/watchtogether-sdk-js 2.6.10 → 2.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @reactoo/watchtogether-sdk-js
|
|
3
|
-
* @version 2.6.
|
|
3
|
+
* @version 2.6.11
|
|
4
4
|
*/
|
|
5
5
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
6
6
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -10114,7 +10114,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _mod
|
|
|
10114
10114
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10115
10115
|
|
|
10116
10116
|
"use strict";
|
|
10117
|
-
eval("__webpack_require__.r(__webpack_exports__);\n\n\
|
|
10117
|
+
eval("__webpack_require__.r(__webpack_exports__);\n\n\nconst getConstraints = _ref => {\n let {\n hasVideo,\n hasAudio = true,\n isHd,\n aDeviceId,\n vDeviceId,\n lfps,\n autoGainControl = false,\n echoCancellation = true,\n noiseSuppression = true,\n channelCount = 1\n } = _ref;\n // optional: Array (6)\n // • 0: {googEchoCancellation: true}\n // • 1: {googEchoCancellation2: true}\n // • 2: {googAutoGainControl: true}\n // • 3: {googNoiseSuppression: true}\n // » 4: {googHighpassFilter: true}\n // • 5: {googAudioMirroring: true}\n // googTypingNoiseDetection\n\n let audioOnlyConstraints = {\n audio: {\n ...(aDeviceId && {\n deviceId: {\n exact: aDeviceId\n }\n }),\n autoGainControl,\n echoCancellation,\n noiseSuppression,\n channelCount\n }\n };\n let videoOnlyConstraints = {\n video: {\n ...(vDeviceId && {\n deviceId: {\n exact: vDeviceId\n }\n }),\n facingMode: {\n ideal: \"user\"\n },\n ...(lfps ? {\n frameRate: {\n ideal: 10,\n max: 30\n }\n } : {\n frameRate: {\n ideal: 30,\n max: 30\n }\n }),\n width: {\n ideal: isHd ? 1280 : 320\n },\n height: {\n ideal: isHd ? 720 : 240\n }\n }\n };\n return {\n ...(hasAudio ? audioOnlyConstraints : {\n audio: false\n }),\n ...(hasVideo ? videoOnlyConstraints : {\n video: false\n })\n };\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n //TODO: add more constraints\n applyConstraints(_ref2) {\n let {\n isHd,\n lfps,\n autoGainControl = false,\n echoCancellation = true,\n noiseSuppression = true,\n channelCount = 1,\n stream = null\n } = _ref2;\n if (stream) {\n let fullConstraints = getConstraints({\n hasVideo: true,\n hasAudio: true,\n autoGainControl,\n echoCancellation,\n noiseSuppression,\n channelCount,\n isHd,\n lfps\n });\n let returnPromises = [];\n\n // const videoTrack = stream.getVideoTracks()[0];\n // if(videoTrack) {\n // returnPromises.push(videoTrack.applyConstraints(fullConstraints.video));\n // }\n\n const audioTrack = stream.getAudioTracks()[0];\n if (audioTrack) {\n returnPromises.push(audioTrack.applyConstraints(fullConstraints.audio));\n }\n return Promise.all(returnPromises).then(() => {\n return stream;\n });\n } else return Promise.resolve(null);\n },\n getUserStream() {\n let {\n hasVideo,\n hasAudio = true,\n aDeviceId,\n vDeviceId,\n isHd,\n lfps,\n autoGainControl = false,\n echoCancellation = true,\n noiseSuppression = true,\n channelCount = 1,\n muteAudio = false,\n muteVideo = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let fullConstraints = getConstraints({\n hasVideo,\n hasAudio,\n isHd,\n aDeviceId,\n vDeviceId,\n lfps,\n autoGainControl,\n echoCancellation,\n noiseSuppression,\n channelCount\n });\n return navigator.mediaDevices.getUserMedia(fullConstraints).then(stream => {\n stream.getAudioTracks().forEach(track => track.enabled = !muteAudio);\n stream.getVideoTracks().forEach(track => track.enabled = !muteVideo);\n return stream;\n });\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/utils.js?");
|
|
10118
10118
|
|
|
10119
10119
|
/***/ }),
|
|
10120
10120
|
|