@webex/plugin-meetings 3.0.0-beta.140 → 3.0.0-beta.142

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.
@@ -186,7 +186,7 @@ var Breakout = _webexCore.WebexPlugin.extend({
186
186
  sessionId: this.sessionId
187
187
  });
188
188
  },
189
- version: "3.0.0-beta.140"
189
+ version: "3.0.0-beta.142"
190
190
  });
191
191
  var _default = Breakout;
192
192
  exports.default = _default;
@@ -1005,7 +1005,7 @@ var Breakouts = _webexCore.WebexPlugin.extend({
1005
1005
  this.trigger(_constants.BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
1006
1006
  }
1007
1007
  },
1008
- version: "3.0.0-beta.140"
1008
+ version: "3.0.0-beta.142"
1009
1009
  });
1010
1010
  var _default = Breakouts;
1011
1011
  exports.default = _default;
@@ -78,6 +78,18 @@ Media.getLocalMedia = function (options, config) {
78
78
  }
79
79
  return _promise.default.resolve(undefined);
80
80
  };
81
+ Media.getDirection = function (receive, send) {
82
+ if (!receive && !send) {
83
+ return 'inactive';
84
+ }
85
+ if (receive && send) {
86
+ return 'sendrecv';
87
+ }
88
+ if (receive) {
89
+ return 'recvonly';
90
+ }
91
+ return 'sendonly';
92
+ };
81
93
 
82
94
  /**
83
95
  * creates a webrtc media connection with provided tracks and mediaDirection configuration
@@ -146,17 +158,17 @@ Media.createMediaConnection = function (isMultistream, debugId, options) {
146
158
  disableRtx: !enableRtx // see https://bugs.chromium.org/p/chromium/issues/detail?id=1020642 why we might want to remove RTX from SDP
147
159
  }
148
160
  }, {
149
- send: {
161
+ localTracks: {
150
162
  audio: audioTrack === null || audioTrack === void 0 ? void 0 : audioTrack.underlyingTrack,
151
163
  video: videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.underlyingTrack,
152
164
  screenShareVideo: shareTrack === null || shareTrack === void 0 ? void 0 : shareTrack.underlyingTrack
153
165
  },
154
- receive: {
155
- audio: mediaDirection.receiveAudio,
156
- video: mediaDirection.receiveVideo,
157
- screenShareVideo: mediaDirection.receiveShare,
158
- remoteQualityLevel: remoteQualityLevel
159
- }
166
+ direction: {
167
+ audio: Media.getDirection(mediaDirection.receiveAudio, mediaDirection.sendAudio),
168
+ video: Media.getDirection(mediaDirection.receiveVideo, mediaDirection.sendVideo),
169
+ screenShareVideo: Media.getDirection(mediaDirection.receiveShare, mediaDirection.sendShare)
170
+ },
171
+ remoteQualityLevel: remoteQualityLevel
160
172
  }, debugId);
161
173
  };
162
174
 
@@ -1 +1 @@
1
- {"version":3,"names":["BrowserDetection","isBrowser","Media","getLocalMedia","options","config","sendAudio","sendVideo","sendShare","sharePreferences","isSharing","getMedia","getDisplayMedia","resolve","undefined","createMediaConnection","isMultistream","debugId","mediaProperties","remoteQualityLevel","enableRtx","enableExtmap","turnServerInfo","bundlePolicy","iceServers","push","urls","url","username","credential","password","enableMainAudio","mediaDirection","receiveAudio","enableMainVideo","receiveVideo","MultistreamRoapMediaConnection","Error","audioTrack","videoTrack","shareTrack","RoapMediaConnection","skipInactiveTransceivers","requireH264","sdpMunging","convertPort9to0","addContentSlides","bandwidthLimits","audio","StaticConfig","meetings","bandwidth","video","startBitrate","periodicKeyframes","disableExtmap","disableRtx","send","underlyingTrack","screenShareVideo","receive","receiveShare","customResolution","screenResolution","customShareFrameRate","screenFrameRate","hasSharePreferences","hasCustomConstraints","shareConstraints","hasHighFrameRate","highFrameRate","Config","resolution","videoShareFrameRate","aspectRatio","cursor","MEDIA_TRACK_CONSTRAINT","CURSOR","AWLAYS","frameRate","height","idealHeight","width","idealWidth","mediaConfig","navigator","mediaDevices","then","stream","getVideoTracks","length","applyConstraints","getDisplayMediaParams","defaultWidth","ideal","max","maxWidth","defaultHeight","maxHeight","deviceId","facingMode","fake","process","env","NODE_ENV","getUserMedia","catch","err","logPath","LoggerProxy","logger","error","constraint","getSupportedDevice","enumerateDevices","devices","supported","filter","device","kind","AUDIO_INPUT","VIDEO_INPUT","getDevices","reject","MediaError","toggleStream","stopTracks","track","stop","e","readyState","mediaSetting","audioVideo","localStream","shareStream"],"sources":["index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n/* globals navigator */\n\nimport {RoapMediaConnection, MultistreamRoapMediaConnection} from '@webex/internal-media-core';\nimport {LocalCameraTrack, LocalDisplayTrack, LocalMicrophoneTrack} from '@webex/media-helpers';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {AUDIO_INPUT, VIDEO_INPUT, MEDIA_TRACK_CONSTRAINT} from '../constants';\nimport Config from '../config';\nimport StaticConfig from '../common/config';\nimport MediaError from '../common/errors/media';\nimport BrowserDetection from '../common/browser-detection';\n\nconst {isBrowser} = BrowserDetection();\n\ntype MultistreamConnectionConfig = ConstructorParameters<typeof MultistreamRoapMediaConnection>[0];\n\nexport type BundlePolicy = ConstructorParameters<\n typeof MultistreamRoapMediaConnection\n>[0]['bundlePolicy'];\n\n/**\n * MediaDirection\n * @typedef {Object} MediaDirection\n * @property {boolean} sendAudio\n * @property {boolean} receiveAudio\n * @property {boolean} sendVideo\n * @property {boolean} receiveVideo\n * @property {boolean} sendShare\n * @property {boolean} receiveShare\n */\n\n/**\n * SendOptions\n * @typedef {Object} SendOptions\n * @property sendAudio\n * @property sendVideo\n * @property sendShare\n * @property isSharing\n * @property {Object} sharePreferences\n */\n/**\n *\n * @public\n * @export\n * Mimic browser APIs as \"the ultimate browser\".\n * Handles the quirks of each browser.\n * Extends and enhances adapter.js, i.e., the \"media\" file from the web client.\n */\nconst Media: any = {};\n\n/**\n * make a browser call to get the media\n * @param {SendOptions} options\n * @param {Object} config SDK Configuration for meetings plugin\n * @returns {Promise}\n */\nMedia.getLocalMedia = (options: any, config: object) => {\n const {sendAudio, sendVideo, sendShare, sharePreferences, isSharing} = options;\n\n if (sendAudio || sendVideo) {\n return Media.getMedia(sendAudio, sendVideo, config);\n }\n\n if (sendShare && !isSharing) {\n return Media.getDisplayMedia(\n {\n sendAudio: false,\n sendShare: true,\n sharePreferences,\n },\n config\n );\n }\n\n return Promise.resolve(undefined);\n};\n\n/**\n * creates a webrtc media connection with provided tracks and mediaDirection configuration\n *\n * @param {boolean} isMultistream\n * @param {string} debugId string useful for debugging (will appear in media connection logs)\n * @param {Object} options\n * @param {Object} [options.mediaProperties] contains mediaDirection and local tracks:\n * audioTrack, videoTrack and shareTrack\n * @param {string} [options.remoteQualityLevel] LOW|MEDIUM|HIGH applicable only to non-multistream connections\n * @param {boolean} [options.enableRtx] applicable only to non-multistream connections\n * @param {boolean} [options.enableExtmap] applicable only to non-multistream connections\n * @param {Object} [options.turnServerInfo]\n * @param {BundlePolicy} [options.bundlePolicy]\n * @returns {RoapMediaConnection | MultistreamRoapMediaConnection}\n */\nMedia.createMediaConnection = (\n isMultistream: boolean,\n debugId: string,\n options: {\n mediaProperties: {\n mediaDirection?: {\n receiveAudio: boolean;\n receiveVideo: boolean;\n receiveShare: boolean;\n sendAudio: boolean;\n sendVideo: boolean;\n sendShare: boolean;\n };\n audioTrack?: LocalMicrophoneTrack;\n videoTrack?: LocalCameraTrack;\n shareTrack?: LocalDisplayTrack;\n };\n remoteQualityLevel?: 'LOW' | 'MEDIUM' | 'HIGH';\n enableRtx?: boolean;\n enableExtmap?: boolean;\n turnServerInfo?: {\n url: string;\n username: string;\n password: string;\n };\n bundlePolicy?: BundlePolicy;\n }\n) => {\n const {\n mediaProperties,\n remoteQualityLevel,\n enableRtx,\n enableExtmap,\n turnServerInfo,\n bundlePolicy,\n } = options;\n\n const iceServers = [];\n\n if (turnServerInfo) {\n iceServers.push({\n urls: turnServerInfo.url,\n username: turnServerInfo.username || '',\n credential: turnServerInfo.password || '',\n });\n }\n\n if (isMultistream) {\n const config: MultistreamConnectionConfig = {\n iceServers,\n enableMainAudio:\n mediaProperties.mediaDirection?.sendAudio || mediaProperties.mediaDirection?.receiveAudio,\n enableMainVideo:\n mediaProperties.mediaDirection?.sendVideo || mediaProperties.mediaDirection?.receiveVideo,\n };\n\n if (bundlePolicy) {\n config.bundlePolicy = bundlePolicy;\n }\n\n return new MultistreamRoapMediaConnection(config, debugId);\n }\n\n if (!mediaProperties) {\n throw new Error('mediaProperties have to be provided for non-multistream media connections');\n }\n\n const {mediaDirection, audioTrack, videoTrack, shareTrack} = mediaProperties;\n\n return new RoapMediaConnection(\n {\n iceServers,\n skipInactiveTransceivers: false,\n requireH264: true,\n sdpMunging: {\n convertPort9to0: false,\n addContentSlides: true,\n bandwidthLimits: {\n audio: StaticConfig.meetings.bandwidth.audio,\n video: StaticConfig.meetings.bandwidth.video,\n },\n startBitrate: StaticConfig.meetings.bandwidth.startBitrate,\n periodicKeyframes: 20, // it's always been hardcoded in SDK so for now keeping it that way\n disableExtmap: !enableExtmap,\n disableRtx: !enableRtx, // see https://bugs.chromium.org/p/chromium/issues/detail?id=1020642 why we might want to remove RTX from SDP\n },\n },\n {\n send: {\n audio: audioTrack?.underlyingTrack,\n video: videoTrack?.underlyingTrack,\n screenShareVideo: shareTrack?.underlyingTrack,\n },\n receive: {\n audio: mediaDirection.receiveAudio,\n video: mediaDirection.receiveVideo,\n screenShareVideo: mediaDirection.receiveShare,\n remoteQualityLevel,\n },\n },\n debugId\n );\n};\n\n/**\n * generates share streams\n * @param {Object} options parameter\n * @param {Boolean} options.sendAudio send audio from the display share\n * @param {Boolean} options.sendShare send video from the display share\n * @param {Object} options.sharePreferences\n * @param {MediaTrackConstraints} options.sharePreferences.shareConstraints constraints to apply to video\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints}\n * @param {Boolean} options.sharePreferences.highFrameRate if shareConstraints isn't provided, set default values based off of this boolean\n * @param {Object} config SDK Configuration for meetings plugin\n * @returns {Promise.<MediaStream>}\n */\nMedia.getDisplayMedia = (\n options: {\n sendAudio: boolean;\n sendShare: boolean;\n sharePreferences: {\n shareConstraints: MediaTrackConstraints;\n highFrameRate: any;\n };\n },\n config: any = {}\n) => {\n // SDK screen share resolution settings from Webex.init\n const customResolution = config.screenResolution || {};\n // user defined screen share frame rate\n const customShareFrameRate = config.screenFrameRate || null;\n // user defined share preferences\n const hasSharePreferences = options.sharePreferences;\n const hasCustomConstraints = hasSharePreferences && hasSharePreferences.shareConstraints;\n const hasHighFrameRate = hasSharePreferences && hasSharePreferences.highFrameRate;\n const {screenResolution, resolution, videoShareFrameRate, screenFrameRate, aspectRatio} =\n Config.meetings;\n\n let shareConstraints: any = {\n cursor: MEDIA_TRACK_CONSTRAINT.CURSOR.AWLAYS,\n aspectRatio,\n };\n\n if (hasCustomConstraints) {\n shareConstraints = hasSharePreferences.shareConstraints;\n } else if (hasHighFrameRate) {\n shareConstraints = {\n ...shareConstraints,\n frameRate: videoShareFrameRate,\n height: resolution.idealHeight,\n width: resolution.idealWidth,\n ...config.resolution,\n };\n } else {\n shareConstraints = {\n ...shareConstraints,\n frameRate: customShareFrameRate || screenFrameRate,\n height: customResolution.idealHeight || screenResolution.idealHeight,\n width: customResolution.idealWidth || screenResolution.idealWidth,\n ...config.screenResolution,\n };\n }\n\n // chrome and webkit based browsers (edge, safari) automatically adjust everything\n // and we have noticed higher quality with those browser types\n // firefox specifically has some issues with resolution and frame rate decision making\n // so we are making it optional and configurable (with defaults) for firefox\n // to have higher quality, and for developers to control the values\n // eventually we may have to add the same functionality to chrome, OR conversely, get to with firefox\n\n if (isBrowser('firefox')) {\n const mediaConfig: any = {\n audio: options.sendAudio,\n video: options.sendShare,\n };\n\n return navigator.mediaDevices\n .getDisplayMedia({audio: options.sendAudio, video: mediaConfig})\n .then((stream) => {\n if (options.sendShare && stream.getVideoTracks().length > 0) {\n // Firefox has a bug with the spec where changing in the height and width only happens\n // after we get the inital tracks\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1321221\n stream.getVideoTracks()[0].applyConstraints(shareConstraints);\n }\n\n return stream;\n });\n }\n\n const getDisplayMediaParams: any = {video: options.sendShare ? shareConstraints : false};\n\n // safari doesn't support sending screen share audio\n // https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia\n if (options.sendAudio && isBrowser('safari')) {\n getDisplayMediaParams.audio = options.sendAudio;\n }\n\n return navigator.mediaDevices.getDisplayMedia(getDisplayMediaParams);\n};\n\n/**\n * generates audio and video using constraints (often called after getSupportedDevices)\n * @param {Object|Boolean} audio gum constraints\n * @param {Object|Boolean} video gum constraints\n * @param {Object} config SDK Configuration for meetings plugin\n * @returns {Object} {streams}\n */\nMedia.getMedia = (audio: any | boolean, video: any | boolean, config: any) => {\n const defaultWidth = {ideal: config.resolution.idealWidth, max: config.resolution.maxWidth};\n const defaultHeight = {ideal: config.resolution.idealHeight, max: config.resolution.maxHeight};\n const mediaConfig = {\n audio,\n // TODO: Remove temporary workaround once Firefox fixes low constraint issues\n // eslint-disable-next-line no-nested-ternary\n video: video\n ? isBrowser('firefox') && video.width && video.width.max === 320\n ? {\n deviceId: video.deviceId ? video.deviceId : undefined,\n width: 320,\n height: 180,\n frameRate: video.frameRate ? video.frameRate : undefined,\n facingMode: video.facingMode ? video.facingMode : undefined,\n }\n : {\n deviceId: video.deviceId ? video.deviceId : undefined,\n width: video.width ? video.width : defaultWidth,\n height: video.height ? video.height : defaultHeight,\n frameRate: video.frameRate ? video.frameRate : undefined,\n facingMode: video.facingMode ? video.facingMode : undefined,\n }\n : false,\n fake: process.env.NODE_ENV === 'test', // Special case to get fake media for Firefox browser for testing\n };\n\n return navigator.mediaDevices.getUserMedia(mediaConfig).catch((err) => {\n const logPath = 'Media:index#getMedia --> navigator.mediaDevices.getUserMedia';\n\n LoggerProxy.logger.error(`${logPath} failed - ${err} (${err.constraint})`);\n throw err;\n });\n};\n\n/**\n * Checks if the machine has at least one audio or video device (Dont use this for screen share)\n * @param {object} [options]\n * {\n * sendAudio: true/false,\n * sendVideo: true/false\n * }\n * @returns {Object} {\n * sendAudio: true/false,\n * sendVideo: true/false\n *}\n */\nMedia.getSupportedDevice = ({sendAudio, sendVideo}: {sendAudio: boolean; sendVideo: boolean}) =>\n Promise.resolve().then(() => {\n if (!navigator.mediaDevices || navigator.mediaDevices.enumerateDevices === undefined) {\n return {\n sendAudio: false,\n sendVideo: false,\n };\n }\n\n return navigator.mediaDevices.enumerateDevices().then((devices) => {\n const supported = {\n audio: devices.filter((device) => device.kind === AUDIO_INPUT).length > 0,\n video: devices.filter((device) => device.kind === VIDEO_INPUT).length > 0,\n };\n\n return {\n sendAudio: supported.audio && sendAudio,\n sendVideo: supported.video && sendVideo,\n };\n });\n });\n\n/**\n * proxy to browser navigator.mediaDevices.enumerateDevices()\n * @returns {Promise}\n */\nMedia.getDevices = () => {\n if (navigator && navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) {\n return navigator.mediaDevices.enumerateDevices();\n }\n\n return Promise.reject(new MediaError('enumerateDevices not supported.'));\n};\n\n/**\n *\n * Toggle a specific stream\n * noop as of now, does nothing\n * @returns {null}\n */\nMedia.toggleStream = () => {};\n\n/**\n * Stop input stream\n * @param {MediaTrack} track A media stream\n * @returns {null}\n */\nMedia.stopTracks = (track: any) => {\n if (!track) {\n return Promise.resolve();\n }\n\n return Promise.resolve().then(() => {\n if (track && track.stop) {\n try {\n track.stop();\n } catch (e) {\n LoggerProxy.logger.error(\n `Media:index#stopTracks --> Unable to stop the track with state ${track.readyState}, error: ${e}`\n );\n }\n }\n });\n};\n\n/**\n * generates streams for audio video and share\n * @param {object} mediaSetting parameter\n * @param {Object} mediaSetting.sendAudio sendAudio: {Boolean} sendAudio constraints\n * @param {Object} mediaSetting.sendVideo sendVideo: {Boolean} sendVideo constraints\n * @param {Object} mediaSetting.sendShare sendShare: {Boolean} sendShare constraints\n * @param {Object} mediaSetting.isSharing isSharing: {Boolean} isSharing constraints\n * @param {Object} audioVideo parameter\n * @param {Object} audioVideo.audio {deviceId: {String}}\n * @param {Object} audioVideo.video {deviceId: {String}}\n * @param {Object} sharePreferences parameter\n * @param {Object} sharePreferences.shareConstraints parameter\n * @param {Boolean} sharePreferences.highFrameRate parameter\n * @param {Object} config SDK Config\n * @returns {Array} [localStream, shareStream]\n */\nMedia.getUserMedia = (\n mediaSetting: {\n sendAudio: object;\n sendVideo: object;\n sendShare: object;\n isSharing: object;\n },\n audioVideo: {\n audio: object;\n video: object;\n },\n sharePreferences: {\n shareConstraints: object;\n highFrameRate: boolean;\n },\n config: object\n) =>\n Media.getLocalMedia(\n {\n sendAudio: mediaSetting.sendAudio ? audioVideo.audio || mediaSetting.sendAudio : false,\n sendVideo: mediaSetting.sendVideo ? audioVideo.video || mediaSetting.sendVideo : false,\n },\n config\n ).then((localStream) =>\n Media.getLocalMedia(\n {\n sendShare: mediaSetting.sendShare,\n isSharing: mediaSetting.isSharing,\n sharePreferences,\n },\n config\n ).then((shareStream) => [localStream, shareStream])\n );\n\nexport default Media;\n"],"mappings":";;;;;;;;;;;;;;;AAKA;AAEA;AACA;AACA;AACA;AACA;AACA;AAA2D;AAAA;AAE3D,wBAAoB,IAAAA,yBAAgB,GAAE;EAA/BC,SAAS,qBAATA,SAAS;AAQhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,KAAU,GAAG,CAAC,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACAA,KAAK,CAACC,aAAa,GAAG,UAACC,OAAY,EAAEC,MAAc,EAAK;EACtD,IAAOC,SAAS,GAAuDF,OAAO,CAAvEE,SAAS;IAAEC,SAAS,GAA4CH,OAAO,CAA5DG,SAAS;IAAEC,SAAS,GAAiCJ,OAAO,CAAjDI,SAAS;IAAEC,gBAAgB,GAAeL,OAAO,CAAtCK,gBAAgB;IAAEC,SAAS,GAAIN,OAAO,CAApBM,SAAS;EAEnE,IAAIJ,SAAS,IAAIC,SAAS,EAAE;IAC1B,OAAOL,KAAK,CAACS,QAAQ,CAACL,SAAS,EAAEC,SAAS,EAAEF,MAAM,CAAC;EACrD;EAEA,IAAIG,SAAS,IAAI,CAACE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ACjB;IACEG,SAAS,EAAE6H,YAAY,CAAC7H,SAAS,GAAG8H,UAAU,CAACpF,KAAK,IAAImF,YAAY,CAAC7H,SAAS,GAAG,KAAK;IACtFC,SAAS,EAAE4H,YAAY,CAAC5H,SAAS,GAAG6H,UAAU,CAAChF,KAAK,IAAI+E,YAAY,CAAC5H,SAAS,GAAG;EACnF,CAAC,EACDF,MAAM,CACP,CAACkF,IAAI,CAAC,UAAC8C,WAAW;IAAA,OACjBnI,KAAK,CAACC,aAAa,CACjB;MACEK,SAAS,EAAE2H,YAAY,CAAC3H,SAAS;MACjCE,SAAS,EAAEyH,YAAY,CAACzH,SAAS;MACjCD,gBAAgB,EAAhBA;IACF,CAAC,EACDJ,MAAM,CACP,CAACkF,IAAI,CAAC,UAAC+C,WAAW;MAAA,OAAK,CAACD,WAAW,EAAEC,WAAW,CAAC;IAAA,EAAC;EAAA,EACpD;AAAA;AAAC,eAEWpI,KAAK;AAAA"}
1
+ {"version":3,"names":["BrowserDetection","isBrowser","Media","getLocalMedia","options","config","sendAudio","sendVideo","sendShare","sharePreferences","isSharing","getMedia","getDisplayMedia","resolve","undefined","getDirection","receive","send","createMediaConnection","isMultistream","debugId","mediaProperties","remoteQualityLevel","enableRtx","enableExtmap","turnServerInfo","bundlePolicy","iceServers","push","urls","url","username","credential","password","enableMainAudio","mediaDirection","receiveAudio","enableMainVideo","receiveVideo","MultistreamRoapMediaConnection","Error","audioTrack","videoTrack","shareTrack","RoapMediaConnection","skipInactiveTransceivers","requireH264","sdpMunging","convertPort9to0","addContentSlides","bandwidthLimits","audio","StaticConfig","meetings","bandwidth","video","startBitrate","periodicKeyframes","disableExtmap","disableRtx","localTracks","underlyingTrack","screenShareVideo","direction","receiveShare","customResolution","screenResolution","customShareFrameRate","screenFrameRate","hasSharePreferences","hasCustomConstraints","shareConstraints","hasHighFrameRate","highFrameRate","Config","resolution","videoShareFrameRate","aspectRatio","cursor","MEDIA_TRACK_CONSTRAINT","CURSOR","AWLAYS","frameRate","height","idealHeight","width","idealWidth","mediaConfig","navigator","mediaDevices","then","stream","getVideoTracks","length","applyConstraints","getDisplayMediaParams","defaultWidth","ideal","max","maxWidth","defaultHeight","maxHeight","deviceId","facingMode","fake","process","env","NODE_ENV","getUserMedia","catch","err","logPath","LoggerProxy","logger","error","constraint","getSupportedDevice","enumerateDevices","devices","supported","filter","device","kind","AUDIO_INPUT","VIDEO_INPUT","getDevices","reject","MediaError","toggleStream","stopTracks","track","stop","e","readyState","mediaSetting","audioVideo","localStream","shareStream"],"sources":["index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n/* globals navigator */\n\nimport {RoapMediaConnection, MultistreamRoapMediaConnection} from '@webex/internal-media-core';\nimport {LocalCameraTrack, LocalDisplayTrack, LocalMicrophoneTrack} from '@webex/media-helpers';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {AUDIO_INPUT, VIDEO_INPUT, MEDIA_TRACK_CONSTRAINT} from '../constants';\nimport Config from '../config';\nimport StaticConfig from '../common/config';\nimport MediaError from '../common/errors/media';\nimport BrowserDetection from '../common/browser-detection';\n\nconst {isBrowser} = BrowserDetection();\n\ntype MultistreamConnectionConfig = ConstructorParameters<typeof MultistreamRoapMediaConnection>[0];\n\nexport type BundlePolicy = ConstructorParameters<\n typeof MultistreamRoapMediaConnection\n>[0]['bundlePolicy'];\n\n/**\n * MediaDirection\n * @typedef {Object} MediaDirection\n * @property {boolean} sendAudio\n * @property {boolean} receiveAudio\n * @property {boolean} sendVideo\n * @property {boolean} receiveVideo\n * @property {boolean} sendShare\n * @property {boolean} receiveShare\n */\n\n/**\n * SendOptions\n * @typedef {Object} SendOptions\n * @property sendAudio\n * @property sendVideo\n * @property sendShare\n * @property isSharing\n * @property {Object} sharePreferences\n */\n/**\n *\n * @public\n * @export\n * Mimic browser APIs as \"the ultimate browser\".\n * Handles the quirks of each browser.\n * Extends and enhances adapter.js, i.e., the \"media\" file from the web client.\n */\nconst Media: any = {};\n\n/**\n * make a browser call to get the media\n * @param {SendOptions} options\n * @param {Object} config SDK Configuration for meetings plugin\n * @returns {Promise}\n */\nMedia.getLocalMedia = (options: any, config: object) => {\n const {sendAudio, sendVideo, sendShare, sharePreferences, isSharing} = options;\n\n if (sendAudio || sendVideo) {\n return Media.getMedia(sendAudio, sendVideo, config);\n }\n\n if (sendShare && !isSharing) {\n return Media.getDisplayMedia(\n {\n sendAudio: false,\n sendShare: true,\n sharePreferences,\n },\n config\n );\n }\n\n return Promise.resolve(undefined);\n};\n\nMedia.getDirection = (receive: boolean, send: boolean) => {\n if (!receive && !send) {\n return 'inactive';\n }\n\n if (receive && send) {\n return 'sendrecv';\n }\n\n if (receive) {\n return 'recvonly';\n }\n\n return 'sendonly';\n};\n\n/**\n * creates a webrtc media connection with provided tracks and mediaDirection configuration\n *\n * @param {boolean} isMultistream\n * @param {string} debugId string useful for debugging (will appear in media connection logs)\n * @param {Object} options\n * @param {Object} [options.mediaProperties] contains mediaDirection and local tracks:\n * audioTrack, videoTrack and shareTrack\n * @param {string} [options.remoteQualityLevel] LOW|MEDIUM|HIGH applicable only to non-multistream connections\n * @param {boolean} [options.enableRtx] applicable only to non-multistream connections\n * @param {boolean} [options.enableExtmap] applicable only to non-multistream connections\n * @param {Object} [options.turnServerInfo]\n * @param {BundlePolicy} [options.bundlePolicy]\n * @returns {RoapMediaConnection | MultistreamRoapMediaConnection}\n */\nMedia.createMediaConnection = (\n isMultistream: boolean,\n debugId: string,\n options: {\n mediaProperties: {\n mediaDirection?: {\n receiveAudio: boolean;\n receiveVideo: boolean;\n receiveShare: boolean;\n sendAudio: boolean;\n sendVideo: boolean;\n sendShare: boolean;\n };\n audioTrack?: LocalMicrophoneTrack;\n videoTrack?: LocalCameraTrack;\n shareTrack?: LocalDisplayTrack;\n };\n remoteQualityLevel?: 'LOW' | 'MEDIUM' | 'HIGH';\n enableRtx?: boolean;\n enableExtmap?: boolean;\n turnServerInfo?: {\n url: string;\n username: string;\n password: string;\n };\n bundlePolicy?: BundlePolicy;\n }\n) => {\n const {\n mediaProperties,\n remoteQualityLevel,\n enableRtx,\n enableExtmap,\n turnServerInfo,\n bundlePolicy,\n } = options;\n\n const iceServers = [];\n\n if (turnServerInfo) {\n iceServers.push({\n urls: turnServerInfo.url,\n username: turnServerInfo.username || '',\n credential: turnServerInfo.password || '',\n });\n }\n\n if (isMultistream) {\n const config: MultistreamConnectionConfig = {\n iceServers,\n enableMainAudio:\n mediaProperties.mediaDirection?.sendAudio || mediaProperties.mediaDirection?.receiveAudio,\n enableMainVideo:\n mediaProperties.mediaDirection?.sendVideo || mediaProperties.mediaDirection?.receiveVideo,\n };\n\n if (bundlePolicy) {\n config.bundlePolicy = bundlePolicy;\n }\n\n return new MultistreamRoapMediaConnection(config, debugId);\n }\n\n if (!mediaProperties) {\n throw new Error('mediaProperties have to be provided for non-multistream media connections');\n }\n\n const {mediaDirection, audioTrack, videoTrack, shareTrack} = mediaProperties;\n\n return new RoapMediaConnection(\n {\n iceServers,\n skipInactiveTransceivers: false,\n requireH264: true,\n sdpMunging: {\n convertPort9to0: false,\n addContentSlides: true,\n bandwidthLimits: {\n audio: StaticConfig.meetings.bandwidth.audio,\n video: StaticConfig.meetings.bandwidth.video,\n },\n startBitrate: StaticConfig.meetings.bandwidth.startBitrate,\n periodicKeyframes: 20, // it's always been hardcoded in SDK so for now keeping it that way\n disableExtmap: !enableExtmap,\n disableRtx: !enableRtx, // see https://bugs.chromium.org/p/chromium/issues/detail?id=1020642 why we might want to remove RTX from SDP\n },\n },\n {\n localTracks: {\n audio: audioTrack?.underlyingTrack,\n video: videoTrack?.underlyingTrack,\n screenShareVideo: shareTrack?.underlyingTrack,\n },\n direction: {\n audio: Media.getDirection(mediaDirection.receiveAudio, mediaDirection.sendAudio),\n video: Media.getDirection(mediaDirection.receiveVideo, mediaDirection.sendVideo),\n screenShareVideo: Media.getDirection(mediaDirection.receiveShare, mediaDirection.sendShare),\n },\n remoteQualityLevel,\n },\n debugId\n );\n};\n\n/**\n * generates share streams\n * @param {Object} options parameter\n * @param {Boolean} options.sendAudio send audio from the display share\n * @param {Boolean} options.sendShare send video from the display share\n * @param {Object} options.sharePreferences\n * @param {MediaTrackConstraints} options.sharePreferences.shareConstraints constraints to apply to video\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints}\n * @param {Boolean} options.sharePreferences.highFrameRate if shareConstraints isn't provided, set default values based off of this boolean\n * @param {Object} config SDK Configuration for meetings plugin\n * @returns {Promise.<MediaStream>}\n */\nMedia.getDisplayMedia = (\n options: {\n sendAudio: boolean;\n sendShare: boolean;\n sharePreferences: {\n shareConstraints: MediaTrackConstraints;\n highFrameRate: any;\n };\n },\n config: any = {}\n) => {\n // SDK screen share resolution settings from Webex.init\n const customResolution = config.screenResolution || {};\n // user defined screen share frame rate\n const customShareFrameRate = config.screenFrameRate || null;\n // user defined share preferences\n const hasSharePreferences = options.sharePreferences;\n const hasCustomConstraints = hasSharePreferences && hasSharePreferences.shareConstraints;\n const hasHighFrameRate = hasSharePreferences && hasSharePreferences.highFrameRate;\n const {screenResolution, resolution, videoShareFrameRate, screenFrameRate, aspectRatio} =\n Config.meetings;\n\n let shareConstraints: any = {\n cursor: MEDIA_TRACK_CONSTRAINT.CURSOR.AWLAYS,\n aspectRatio,\n };\n\n if (hasCustomConstraints) {\n shareConstraints = hasSharePreferences.shareConstraints;\n } else if (hasHighFrameRate) {\n shareConstraints = {\n ...shareConstraints,\n frameRate: videoShareFrameRate,\n height: resolution.idealHeight,\n width: resolution.idealWidth,\n ...config.resolution,\n };\n } else {\n shareConstraints = {\n ...shareConstraints,\n frameRate: customShareFrameRate || screenFrameRate,\n height: customResolution.idealHeight || screenResolution.idealHeight,\n width: customResolution.idealWidth || screenResolution.idealWidth,\n ...config.screenResolution,\n };\n }\n\n // chrome and webkit based browsers (edge, safari) automatically adjust everything\n // and we have noticed higher quality with those browser types\n // firefox specifically has some issues with resolution and frame rate decision making\n // so we are making it optional and configurable (with defaults) for firefox\n // to have higher quality, and for developers to control the values\n // eventually we may have to add the same functionality to chrome, OR conversely, get to with firefox\n\n if (isBrowser('firefox')) {\n const mediaConfig: any = {\n audio: options.sendAudio,\n video: options.sendShare,\n };\n\n return navigator.mediaDevices\n .getDisplayMedia({audio: options.sendAudio, video: mediaConfig})\n .then((stream) => {\n if (options.sendShare && stream.getVideoTracks().length > 0) {\n // Firefox has a bug with the spec where changing in the height and width only happens\n // after we get the inital tracks\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1321221\n stream.getVideoTracks()[0].applyConstraints(shareConstraints);\n }\n\n return stream;\n });\n }\n\n const getDisplayMediaParams: any = {video: options.sendShare ? shareConstraints : false};\n\n // safari doesn't support sending screen share audio\n // https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia\n if (options.sendAudio && isBrowser('safari')) {\n getDisplayMediaParams.audio = options.sendAudio;\n }\n\n return navigator.mediaDevices.getDisplayMedia(getDisplayMediaParams);\n};\n\n/**\n * generates audio and video using constraints (often called after getSupportedDevices)\n * @param {Object|Boolean} audio gum constraints\n * @param {Object|Boolean} video gum constraints\n * @param {Object} config SDK Configuration for meetings plugin\n * @returns {Object} {streams}\n */\nMedia.getMedia = (audio: any | boolean, video: any | boolean, config: any) => {\n const defaultWidth = {ideal: config.resolution.idealWidth, max: config.resolution.maxWidth};\n const defaultHeight = {ideal: config.resolution.idealHeight, max: config.resolution.maxHeight};\n const mediaConfig = {\n audio,\n // TODO: Remove temporary workaround once Firefox fixes low constraint issues\n // eslint-disable-next-line no-nested-ternary\n video: video\n ? isBrowser('firefox') && video.width && video.width.max === 320\n ? {\n deviceId: video.deviceId ? video.deviceId : undefined,\n width: 320,\n height: 180,\n frameRate: video.frameRate ? video.frameRate : undefined,\n facingMode: video.facingMode ? video.facingMode : undefined,\n }\n : {\n deviceId: video.deviceId ? video.deviceId : undefined,\n width: video.width ? video.width : defaultWidth,\n height: video.height ? video.height : defaultHeight,\n frameRate: video.frameRate ? video.frameRate : undefined,\n facingMode: video.facingMode ? video.facingMode : undefined,\n }\n : false,\n fake: process.env.NODE_ENV === 'test', // Special case to get fake media for Firefox browser for testing\n };\n\n return navigator.mediaDevices.getUserMedia(mediaConfig).catch((err) => {\n const logPath = 'Media:index#getMedia --> navigator.mediaDevices.getUserMedia';\n\n LoggerProxy.logger.error(`${logPath} failed - ${err} (${err.constraint})`);\n throw err;\n });\n};\n\n/**\n * Checks if the machine has at least one audio or video device (Dont use this for screen share)\n * @param {object} [options]\n * {\n * sendAudio: true/false,\n * sendVideo: true/false\n * }\n * @returns {Object} {\n * sendAudio: true/false,\n * sendVideo: true/false\n *}\n */\nMedia.getSupportedDevice = ({sendAudio, sendVideo}: {sendAudio: boolean; sendVideo: boolean}) =>\n Promise.resolve().then(() => {\n if (!navigator.mediaDevices || navigator.mediaDevices.enumerateDevices === undefined) {\n return {\n sendAudio: false,\n sendVideo: false,\n };\n }\n\n return navigator.mediaDevices.enumerateDevices().then((devices) => {\n const supported = {\n audio: devices.filter((device) => device.kind === AUDIO_INPUT).length > 0,\n video: devices.filter((device) => device.kind === VIDEO_INPUT).length > 0,\n };\n\n return {\n sendAudio: supported.audio && sendAudio,\n sendVideo: supported.video && sendVideo,\n };\n });\n });\n\n/**\n * proxy to browser navigator.mediaDevices.enumerateDevices()\n * @returns {Promise}\n */\nMedia.getDevices = () => {\n if (navigator && navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) {\n return navigator.mediaDevices.enumerateDevices();\n }\n\n return Promise.reject(new MediaError('enumerateDevices not supported.'));\n};\n\n/**\n *\n * Toggle a specific stream\n * noop as of now, does nothing\n * @returns {null}\n */\nMedia.toggleStream = () => {};\n\n/**\n * Stop input stream\n * @param {MediaTrack} track A media stream\n * @returns {null}\n */\nMedia.stopTracks = (track: any) => {\n if (!track) {\n return Promise.resolve();\n }\n\n return Promise.resolve().then(() => {\n if (track && track.stop) {\n try {\n track.stop();\n } catch (e) {\n LoggerProxy.logger.error(\n `Media:index#stopTracks --> Unable to stop the track with state ${track.readyState}, error: ${e}`\n );\n }\n }\n });\n};\n\n/**\n * generates streams for audio video and share\n * @param {object} mediaSetting parameter\n * @param {Object} mediaSetting.sendAudio sendAudio: {Boolean} sendAudio constraints\n * @param {Object} mediaSetting.sendVideo sendVideo: {Boolean} sendVideo constraints\n * @param {Object} mediaSetting.sendShare sendShare: {Boolean} sendShare constraints\n * @param {Object} mediaSetting.isSharing isSharing: {Boolean} isSharing constraints\n * @param {Object} audioVideo parameter\n * @param {Object} audioVideo.audio {deviceId: {String}}\n * @param {Object} audioVideo.video {deviceId: {String}}\n * @param {Object} sharePreferences parameter\n * @param {Object} sharePreferences.shareConstraints parameter\n * @param {Boolean} sharePreferences.highFrameRate parameter\n * @param {Object} config SDK Config\n * @returns {Array} [localStream, shareStream]\n */\nMedia.getUserMedia = (\n mediaSetting: {\n sendAudio: object;\n sendVideo: object;\n sendShare: object;\n isSharing: object;\n },\n audioVideo: {\n audio: object;\n video: object;\n },\n sharePreferences: {\n shareConstraints: object;\n highFrameRate: boolean;\n },\n config: object\n) =>\n Media.getLocalMedia(\n {\n sendAudio: mediaSetting.sendAudio ? audioVideo.audio || mediaSetting.sendAudio : false,\n sendVideo: mediaSetting.sendVideo ? audioVideo.video || mediaSetting.sendVideo : false,\n },\n config\n ).then((localStream) =>\n Media.getLocalMedia(\n {\n sendShare: mediaSetting.sendShare,\n isSharing: mediaSetting.isSharing,\n sharePreferences,\n },\n config\n ).then((shareStream) => [localStream, shareStream])\n );\n\nexport default Media;\n"],"mappings":";;;;;;;;;;;;;;;AAKA;AAEA;AACA;AACA;AACA;AACA;AACA;AAA2D;AAAA;AAE3D,wBAAoB,IAAAA,yBAAgB,GAAE;EAA/BC,SAAS,qBAATA,SAAS;AAQhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAA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,OACjBtI,KAAK,CAACC,aAAa,CACjB;MACEK,SAAS,EAAE8H,YAAY,CAAC9H,SAAS;MACjCE,SAAS,EAAE4H,YAAY,CAAC5H,SAAS;MACjCD,gBAAgB,EAAhBA;IACF,CAAC,EACDJ,MAAM,CACP,CAACqF,IAAI,CAAC,UAAC+C,WAAW;MAAA,OAAK,CAACD,WAAW,EAAEC,WAAW,CAAC;IAAA,EAAC;EAAA,EACpD;AAAA;AAAC,eAEWvI,KAAK;AAAA"}
@@ -5463,20 +5463,20 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5463
5463
  return _util.default.validateOptions(options).then(function () {
5464
5464
  return _this43.preMedia(localStream, localShare, mediaSettings);
5465
5465
  }).then(function () {
5466
- return _this43.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5467
- send: {
5466
+ return _this43.mediaProperties.webrtcMediaConnection.update({
5467
+ localTracks: {
5468
5468
  audio: _this43.mediaProperties.mediaDirection.sendAudio ? _this43.mediaProperties.audioTrack.underlyingTrack : null,
5469
5469
  video: _this43.mediaProperties.mediaDirection.sendVideo ? _this43.mediaProperties.videoTrack.underlyingTrack : null,
5470
5470
  screenShareVideo: _this43.mediaProperties.mediaDirection.sendShare ? _this43.mediaProperties.shareTrack.underlyingTrack : null
5471
5471
  },
5472
- receive: {
5473
- audio: _this43.mediaProperties.mediaDirection.receiveAudio,
5474
- video: _this43.mediaProperties.mediaDirection.receiveVideo,
5475
- screenShareVideo: _this43.mediaProperties.mediaDirection.receiveShare,
5476
- remoteQualityLevel: _this43.mediaProperties.remoteQualityLevel
5477
- }
5472
+ direction: {
5473
+ audio: _media.default.getDirection(_this43.mediaProperties.mediaDirection.receiveAudio, _this43.mediaProperties.mediaDirection.sendAudio),
5474
+ video: _media.default.getDirection(_this43.mediaProperties.mediaDirection.receiveVideo, _this43.mediaProperties.mediaDirection.sendVideo),
5475
+ screenShareVideo: _media.default.getDirection(_this43.mediaProperties.mediaDirection.receiveShare, _this43.mediaProperties.mediaDirection.sendShare)
5476
+ },
5477
+ remoteQualityLevel: _this43.mediaProperties.remoteQualityLevel
5478
5478
  }).then(function () {
5479
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " webrtcMediaConnection.updateSendReceiveOptions done"));
5479
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " webrtcMediaConnection.update done"));
5480
5480
  }).catch(function (error) {
5481
5481
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error updatedMedia, "), error);
5482
5482
  _metrics.default.sendBehavioralMetric(_constants2.default.UPDATE_MEDIA_FAILURE, {
@@ -5563,16 +5563,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5563
5563
  sendAudio: sendAudio,
5564
5564
  localStream: stream
5565
5565
  }).then(function () {
5566
- return _this44.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5567
- send: {
5566
+ return _this44.mediaProperties.webrtcMediaConnection.update({
5567
+ localTracks: {
5568
5568
  audio: track
5569
5569
  },
5570
- receive: {
5571
- audio: options.receiveAudio,
5572
- video: _this44.mediaProperties.mediaDirection.receiveVideo,
5573
- screenShareVideo: _this44.mediaProperties.mediaDirection.receiveShare,
5574
- remoteQualityLevel: _this44.mediaProperties.remoteQualityLevel
5575
- }
5570
+ direction: {
5571
+ audio: _media.default.getDirection(receiveAudio, sendAudio),
5572
+ video: _media.default.getDirection(_this44.mediaProperties.mediaDirection.receiveVideo, _this44.mediaProperties.mediaDirection.sendVideo),
5573
+ screenShareVideo: _media.default.getDirection(_this44.mediaProperties.mediaDirection.receiveShare, _this44.mediaProperties.mediaDirection.sendShare)
5574
+ },
5575
+ remoteQualityLevel: _this44.mediaProperties.remoteQualityLevel
5576
5576
  });
5577
5577
  }).then(function () {
5578
5578
  _this44.setLocalAudioTrack(track);
@@ -5631,16 +5631,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5631
5631
  sendVideo: sendVideo,
5632
5632
  localStream: stream
5633
5633
  }).then(function () {
5634
- return _this45.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5635
- send: {
5634
+ return _this45.mediaProperties.webrtcMediaConnection.update({
5635
+ localTracks: {
5636
5636
  video: track
5637
5637
  },
5638
- receive: {
5639
- audio: _this45.mediaProperties.mediaDirection.receiveAudio,
5640
- video: options.receiveVideo,
5641
- screenShareVideo: _this45.mediaProperties.mediaDirection.receiveShare,
5642
- remoteQualityLevel: _this45.mediaProperties.remoteQualityLevel
5643
- }
5638
+ direction: {
5639
+ audio: _media.default.getDirection(_this45.mediaProperties.mediaDirection.receiveAudio, _this45.mediaProperties.mediaDirection.sendAudio),
5640
+ video: _media.default.getDirection(receiveVideo, sendVideo),
5641
+ screenShareVideo: _media.default.getDirection(_this45.mediaProperties.mediaDirection.receiveShare, _this45.mediaProperties.mediaDirection.sendShare)
5642
+ },
5643
+ remoteQualityLevel: _this45.mediaProperties.remoteQualityLevel
5644
5644
  });
5645
5645
  }).then(function () {
5646
5646
  _this45.setLocalVideoTrack(track);
@@ -5716,16 +5716,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5716
5716
  }).then(function () {
5717
5717
  return _this46.checkForStopShare(sendShare, previousSendShareStatus);
5718
5718
  }).then(function (startShare) {
5719
- return _this46.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5720
- send: {
5719
+ return _this46.mediaProperties.webrtcMediaConnection.update({
5720
+ localTracks: {
5721
5721
  screenShareVideo: track
5722
5722
  },
5723
- receive: {
5724
- audio: _this46.mediaProperties.mediaDirection.receiveAudio,
5725
- video: _this46.mediaProperties.mediaDirection.receiveVideo,
5726
- screenShareVideo: options.receiveShare,
5727
- remoteQualityLevel: _this46.mediaProperties.remoteQualityLevel
5728
- }
5723
+ direction: {
5724
+ audio: _media.default.getDirection(_this46.mediaProperties.mediaDirection.receiveAudio, _this46.mediaProperties.mediaDirection.sendAudio),
5725
+ video: _media.default.getDirection(_this46.mediaProperties.mediaDirection.receiveVideo, _this46.mediaProperties.mediaDirection.sendVideo),
5726
+ screenShareVideo: _media.default.getDirection(receiveShare, sendShare)
5727
+ },
5728
+ remoteQualityLevel: _this46.mediaProperties.remoteQualityLevel
5729
5729
  }).then(function () {
5730
5730
  return _this46.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.LAMBDA, {
5731
5731
  lambda: function () {