@signalwire/js
Advanced tools
Comparing version 1.3.0-cantina.59 to 1.3.0-cantina.60
@@ -39,2 +39,7 @@ import { PeerType } from './constants'; | ||
applyMediaConstraints(kind: string, constraints: MediaTrackConstraints): Promise<void>; | ||
setVideoSenderParameters(params: { | ||
height: number; | ||
rate: number; | ||
scaleResolutionDownBy: number; | ||
}): Promise<void>; | ||
private _getSenderByKind; | ||
@@ -41,0 +46,0 @@ private _getReceiverByKind; |
@@ -190,2 +190,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
setVideoSenderParameters(params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const { height, rate, scaleResolutionDownBy } = params; | ||
const sender = this._getSenderByKind('video'); | ||
if (!sender || !sender.track) { | ||
return logger.info('No sender to setParameters to', params); | ||
} | ||
if (sender.track.readyState === 'live') { | ||
const currentParams = sender.getParameters(); | ||
if (currentParams.encodings) { | ||
const currentHeight = sender.track.getSettings().height; | ||
if (currentHeight && height) { | ||
currentParams.encodings[0].scaleResolutionDownBy = Math.max((currentHeight / height), 1); | ||
} | ||
if (scaleResolutionDownBy) { | ||
currentParams.encodings[0].scaleResolutionDownBy = scaleResolutionDownBy; | ||
} | ||
if (rate) { | ||
currentParams.encodings[0].maxBitrate = rate; | ||
} | ||
} | ||
logger.info('Apply video parameters', currentParams); | ||
yield sender.setParameters(currentParams); | ||
} | ||
} | ||
catch (error) { | ||
logger.error('Error applying video parameters', params); | ||
} | ||
}); | ||
} | ||
_getSenderByKind(kind) { | ||
@@ -192,0 +223,0 @@ if (this.instance) { |
@@ -5,3 +5,3 @@ import Relay from './src/SignalWire'; | ||
import VertoConference from '../common/src/webrtc/Conference'; | ||
export declare const VERSION = "1.3.0-cantina.59"; | ||
export declare const VERSION = "1.3.0-cantina.60"; | ||
export { Relay, Verto, CantinaAuth, VertoConference, }; | ||
@@ -8,0 +8,0 @@ export * from '../common/src/webrtc/deviceHelpers'; |
@@ -6,5 +6,5 @@ import Relay from './src/SignalWire'; | ||
import VertoConference from '../common/src/webrtc/Conference'; | ||
export const VERSION = '1.3.0-cantina.59'; | ||
export const VERSION = '1.3.0-cantina.60'; | ||
setAgentName(`JavaScript SDK/${VERSION}`); | ||
export { Relay, Verto, CantinaAuth, VertoConference, }; | ||
export * from '../common/src/webrtc/deviceHelpers'; |
@@ -58,3 +58,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const callIds = this.callIds; | ||
return callIds.length && callIds.every(callId => { | ||
return callIds.length && callIds.some(callId => { | ||
var _a, _b; | ||
@@ -61,0 +61,0 @@ return (_b = (_a = this.calls[callId]) === null || _a === void 0 ? void 0 : _a.peer) === null || _b === void 0 ? void 0 : _b.needResume; |
{ | ||
"name": "@signalwire/js", | ||
"version": "1.3.0-cantina.59", | ||
"version": "1.3.0-cantina.60", | ||
"description": "Relay SDK for JavaScript to connect to SignalWire.", | ||
@@ -5,0 +5,0 @@ "author": "SignalWire Team <open.source@signalwire.com>", |
Sorry, the diff of this file is too big to display
445099
6481