From 7c8f2a3e68efee33192f516b3f4a279fb4a759ab Mon Sep 17 00:00:00 2001 From: z-dule Date: Mon, 23 Oct 2023 09:22:02 +0200 Subject: [PATCH] feat: firefox conference calling (#16015) --- package.json | 2 +- src/script/calling/CallingRepository.ts | 4 +++- src/script/util/test/mock/WebRTCMock.ts | 11 ++++++++++- src/types/NodeModules.d.ts | 1 + yarn.lock | 10 +++++----- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index b2695041a8b..d210de31c8a 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "@lexical/history": "0.12.2", "@lexical/react": "0.12.2", "@peculiar/x509": "1.9.5", - "@wireapp/avs": "9.4.18", + "@wireapp/avs": "9.5.2", "@wireapp/commons": "5.2.1", "@wireapp/core": "42.16.0", "@wireapp/lru-cache": "3.8.1", diff --git a/src/script/calling/CallingRepository.ts b/src/script/calling/CallingRepository.ts index ab6ed043ba1..289f732273c 100644 --- a/src/script/calling/CallingRepository.ts +++ b/src/script/calling/CallingRepository.ts @@ -143,6 +143,7 @@ export class CallingRepository { private wCall?: Wcall; private wUser: number = 0; private nextMuteState: MuteState = MuteState.SELF_MUTED; + private isConferenceCallingSupported = false; /** * Keeps track of the size of the avs log once the webapp is initiated. This allows detecting meaningless avs logs (logs that have a length equal to the length when the webapp was initiated) */ @@ -255,6 +256,7 @@ export class CallingRepository { wCall.setUserMediaHandler(this.getCallMediaStream); wCall.setAudioStreamHandler(this.updateCallAudioStreams); wCall.setVideoStreamHandler(this.updateParticipantVideoStream); + this.isConferenceCallingSupported = wCall.isConferenceCallingSupported(); setInterval(() => wCall.poll(), 500); return wCall; } @@ -499,7 +501,7 @@ export class CallingRepository { * @see https://www.chromestatus.com/feature/6321945865879552 */ get supportsConferenceCalling(): boolean { - return Runtime.isSupportingConferenceCalling(); + return this.isConferenceCallingSupported; } /** diff --git a/src/script/util/test/mock/WebRTCMock.ts b/src/script/util/test/mock/WebRTCMock.ts index 880fa5cd218..c5338e82a16 100644 --- a/src/script/util/test/mock/WebRTCMock.ts +++ b/src/script/util/test/mock/WebRTCMock.ts @@ -19,14 +19,18 @@ import wrtc from '@koush/wrtc'; -const {RTCAudioSource} = wrtc.nonstandard; +const {RTCAudioSource, RTCRtpSender} = wrtc.nonstandard; declare global { interface Window { MediaStream: typeof wrtc.MediaStream; RTCAudioSource: typeof RTCAudioSource; + RTCRtpSender: typeof RTCRtpSender; } } +const RTCRtpSenderMock: Window['RTCRtpSender'] = { + prototype: {createEncodedVideoStreams: {}, createEncodedStreams: {}, transform: {}}, +}; Object.defineProperty(window, 'MediaStream', { value: wrtc.MediaStream, @@ -37,3 +41,8 @@ Object.defineProperty(window, 'RTCAudioSource', { value: RTCAudioSource, writable: true, }); + +Object.defineProperty(window, 'RTCRtpSender', { + value: RTCRtpSenderMock, + writable: true, +}); diff --git a/src/types/NodeModules.d.ts b/src/types/NodeModules.d.ts index c2cc54f71fc..1ca9d3d6621 100644 --- a/src/types/NodeModules.d.ts +++ b/src/types/NodeModules.d.ts @@ -20,6 +20,7 @@ declare module '@koush/wrtc' { export const nonstandard: { RTCAudioSource: any; + RTCRtpSender: {prototype: {createEncodedVideoStreams: any; createEncodedStreams: any; transform: any}}; }; export const MediaStream: any; } diff --git a/yarn.lock b/yarn.lock index 39fdeb17ae7..a5c8fda23a5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5316,10 +5316,10 @@ __metadata: languageName: node linkType: hard -"@wireapp/avs@npm:9.4.18": - version: 9.4.18 - resolution: "@wireapp/avs@npm:9.4.18" - checksum: 6786018a880336bba8b1e00cc35de0b5834efedd3ecd8cc5c905fb40ef9cb3b8adc63d23bd202e3ba58e104fd4b9b011900d76f951e84e62de0bea0b5a8f32be +"@wireapp/avs@npm:9.5.2": + version: 9.5.2 + resolution: "@wireapp/avs@npm:9.5.2" + checksum: e728dfed25af97c6dee587a7f9174466971866993e098a0017eba37ed40a70b4a4155f4f9ab25968020e048ee1a31ced8ae9a224ee77cb793a556b40a01950af languageName: node linkType: hard @@ -18520,7 +18520,7 @@ __metadata: "@types/speakingurl": 13.0.4 "@types/underscore": 1.11.12 "@types/webpack-env": 1.18.3 - "@wireapp/avs": 9.4.18 + "@wireapp/avs": 9.5.2 "@wireapp/commons": 5.2.1 "@wireapp/copy-config": 2.1.9 "@wireapp/core": 42.16.0