From fcd37248dc7616c42f0704313587caf2a0d3ee09 Mon Sep 17 00:00:00 2001 From: Billy Lindeman Date: Fri, 26 Mar 2021 12:36:35 -0700 Subject: [PATCH] 1.6.3 --- package-lock.json | 2 +- package.json | 2 +- src/client.ts | 18 +++++++++++------- src/stream.ts | 10 +++++----- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b8e9484..4968b602 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ion-sdk-js", - "version": "1.6.2", + "version": "1.6.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3150044d..c426541c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ion-sdk-js", - "version": "1.6.2", + "version": "1.6.3", "description": "A js sdk for ion sfu", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/client.ts b/src/client.ts index 28304c26..39acfb15 100644 --- a/src/client.ts +++ b/src/client.ts @@ -67,7 +67,12 @@ export default class Client { ontrack?: (track: MediaStreamTrack, stream: RemoteStream) => void; ondatachannel?: (ev: RTCDataChannelEvent) => void; onspeaker?: (ev: string[]) => void; - onerrnegotiate?: (role: Role, err: Error, offer?: RTCSessionDescriptionInit, answer?: RTCSessionDescriptionInit) => void; + onerrnegotiate?: ( + role: Role, + err: Error, + offer?: RTCSessionDescriptionInit, + answer?: RTCSessionDescriptionInit, + ) => void; constructor( signal: Signal, @@ -185,7 +190,7 @@ export default class Client { throw Error(ERR_NO_SESSION); } - let answer: RTCSessionDescriptionInit|undefined; + let answer: RTCSessionDescriptionInit | undefined; try { await this.transports[Role.sub].pc.setRemoteDescription(description); this.transports[Role.sub].candidates.forEach((c) => this.transports![Role.sub].pc.addIceCandidate(c)); @@ -196,9 +201,8 @@ export default class Client { } catch (err) { /* tslint:disable-next-line:no-console */ console.error(err); - if(this.onerrnegotiate) this.onerrnegotiate(Role.sub, err, description, answer) + if (this.onerrnegotiate) this.onerrnegotiate(Role.sub, err, description, answer); } - } private async onNegotiationNeeded() { @@ -206,8 +210,8 @@ export default class Client { throw Error(ERR_NO_SESSION); } - let offer: RTCSessionDescriptionInit|undefined; - let answer: RTCSessionDescriptionInit|undefined; + let offer: RTCSessionDescriptionInit | undefined; + let answer: RTCSessionDescriptionInit | undefined; try { offer = await this.transports[Role.pub].pc.createOffer(); await this.transports[Role.pub].pc.setLocalDescription(offer); @@ -216,7 +220,7 @@ export default class Client { } catch (err) { /* tslint:disable-next-line:no-console */ console.error(err); - if(this.onerrnegotiate) this.onerrnegotiate(Role.pub, err, offer, answer); + if (this.onerrnegotiate) this.onerrnegotiate(Role.pub, err, offer, answer); } } } diff --git a/src/stream.ts b/src/stream.ts index df4c0db6..851f6547 100644 --- a/src/stream.ts +++ b/src/stream.ts @@ -257,25 +257,25 @@ export class LocalStream extends MediaStream { let selCodec: RTCRtpCodecCapability | undefined; if (this.constraints.preferredCodecProfile && kind === 'video') { - const allCodecProfiles = cap.codecs.filter((c) => c.mimeType.toLowerCase() === `video/${this.constraints.codec.toLowerCase()}`); + const allCodecProfiles = cap.codecs.filter( + (c) => c.mimeType.toLowerCase() === `video/${this.constraints.codec.toLowerCase()}`, + ); if (!allCodecProfiles) { return; } selCodec = allCodecProfiles.find( (c) => - c.sdpFmtpLine && - c.sdpFmtpLine?.indexOf(`profile-level-id=${this.constraints.preferredCodecProfile}`) >= 0 + c.sdpFmtpLine && c.sdpFmtpLine?.indexOf(`profile-level-id=${this.constraints.preferredCodecProfile}`) >= 0, ); if (!selCodec) { // get first one selCodec = allCodecProfiles[0]; - } } else { selCodec = cap.codecs.find( (c) => c.mimeType.toLowerCase() === `video/${this.constraints.codec.toLowerCase()}` || - c.mimeType.toLowerCase() === `audio/opus` + c.mimeType.toLowerCase() === `audio/opus`, ); } if (selCodec) {