From 568973ea570723c402fd9a7cf7c169e13e049340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 12 Dec 2024 14:00:25 +0100 Subject: [PATCH 1/3] feat(RTC) drop PERMISSION_PROMPT_IS_SHOWN event It was never accurate since browsers have changed their behavior over time and can be implemented in the application more reliably. --- JitsiMeetJS.ts | 13 ++----------- modules/RTC/RTC.js | 8 -------- modules/RTC/RTCUtils.js | 8 -------- types/hand-crafted/modules/RTC/RTC.d.ts | 1 - types/hand-crafted/modules/RTC/RTCUtils.d.ts | 1 - 5 files changed, 2 insertions(+), 29 deletions(-) diff --git a/JitsiMeetJS.ts b/JitsiMeetJS.ts index 78b3c434ec..c1f01ec442 100644 --- a/JitsiMeetJS.ts +++ b/JitsiMeetJS.ts @@ -273,8 +273,6 @@ export default { * which should be created. should be created or some additional * configurations about resolution for example. * @param {Array} options.effects optional effects array for the track - * @param {boolean} options.firePermissionPromptIsShownEvent - if event - * JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN should be fired * @param {Array} options.devices the devices that will be requested * @param {string} options.resolution resolution constraints * @param {string} options.cameraDeviceId @@ -285,13 +283,6 @@ export default { * JitsiConferenceError if rejected. */ createLocalTracks(options: ICreateLocalTrackOptions = {}) { - const { firePermissionPromptIsShownEvent, ...restOptions } = options; - - if (firePermissionPromptIsShownEvent && !RTC.arePermissionsGrantedForAvailableDevices()) { - // @ts-ignore - JitsiMediaDevices.emit(JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN, browser.getName()); - } - let isFirstGUM = false; let startTS = window.performance.now(); @@ -306,7 +297,7 @@ export default { } window.connectionTimes['obtainPermissions.start'] = startTS; - return RTC.obtainAudioAndVideoPermissions(restOptions) + return RTC.obtainAudioAndVideoPermissions(options) .then(tracks => { let endTS = window.performance.now(); @@ -319,7 +310,7 @@ export default { Statistics.sendAnalytics( createGetUserMediaEvent( 'success', - getAnalyticsAttributesFromOptions(restOptions))); + getAnalyticsAttributesFromOptions(options))); if (this.isCollectingLocalStats()) { for (let i = 0; i < tracks.length; i++) { diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index e4fd348078..f4ac6a8676 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -631,14 +631,6 @@ export default class RTC extends Listenable { return RTCUtils.getCurrentlyAvailableMediaDevices(); } - /** - * Returns whether available devices have permissions granted - * @returns {Boolean} - */ - static arePermissionsGrantedForAvailableDevices() { - return RTCUtils.arePermissionsGrantedForAvailableDevices(); - } - /** * Returns event data for device to be reported to stats. * @returns {MediaDeviceInfo} device. diff --git a/modules/RTC/RTCUtils.js b/modules/RTC/RTCUtils.js index 2dba1c021a..3362a5b215 100644 --- a/modules/RTC/RTCUtils.js +++ b/modules/RTC/RTCUtils.js @@ -827,14 +827,6 @@ class RTCUtils extends Listenable { return availableDevices; } - /** - * Returns whether available devices have permissions granted - * @returns {Boolean} - */ - arePermissionsGrantedForAvailableDevices() { - return availableDevices.some(device => Boolean(device.label)); - } - /** * Returns event data for device to be reported to stats. * @returns {MediaDeviceInfo} device. diff --git a/types/hand-crafted/modules/RTC/RTC.d.ts b/types/hand-crafted/modules/RTC/RTC.d.ts index 14e0e2b3cd..e2731b429e 100644 --- a/types/hand-crafted/modules/RTC/RTC.d.ts +++ b/types/hand-crafted/modules/RTC/RTC.d.ts @@ -42,6 +42,5 @@ export default class RTC extends Listenable { isInForwardedSources: ( sourceName: string ) => boolean; setReceiverVideoConstraints: ( constraints: unknown ) => void; // TODO: setVideoMute: ( value: unknown ) => Promise; // TODO: - arePermissionsGrantedForAvailableDevices: () => boolean; sendEndpointStatsMessage: ( payload: unknown ) => void; // TODO: } diff --git a/types/hand-crafted/modules/RTC/RTCUtils.d.ts b/types/hand-crafted/modules/RTC/RTCUtils.d.ts index caa3f1ce0a..77c903eef0 100644 --- a/types/hand-crafted/modules/RTC/RTCUtils.d.ts +++ b/types/hand-crafted/modules/RTC/RTCUtils.d.ts @@ -14,7 +14,6 @@ declare class RTCUtils extends Listenable { getAudioOutputDevice: () => string; getCurrentlyAvailableMediaDevices: () => unknown[]; // TODO: getEventDataForActiveDevice: ( device: MediaDeviceInfo ) => unknown; // TODO: - arePermissionsGrantedForAvailableDevices: () => boolean; isUserStreamById: ( streamId: string ) => boolean; } From f8e33ad8e591e042f4fabadc792c0861e79eff6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Fri, 13 Dec 2024 10:57:40 -0600 Subject: [PATCH 2/3] squash: Update JitsiMeetJS.ts --- JitsiMeetJS.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/JitsiMeetJS.ts b/JitsiMeetJS.ts index c1f01ec442..f7fb75cd00 100644 --- a/JitsiMeetJS.ts +++ b/JitsiMeetJS.ts @@ -71,7 +71,6 @@ function getAnalyticsAttributesFromOptions(options) { interface ICreateLocalTrackOptions { cameraDeviceId?: string; devices?: any[]; - firePermissionPromptIsShownEvent?: boolean; fireSlowPromiseEvent?: boolean; micDeviceId?: string; resolution?: string; From c6de46406030e90fa9c4e4c89677fd1be8dc2049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Fri, 13 Dec 2024 10:59:17 -0600 Subject: [PATCH 3/3] squash: Update hand-crafted JitsiMeetJS.d.ts --- types/hand-crafted/JitsiMeetJS.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/hand-crafted/JitsiMeetJS.d.ts b/types/hand-crafted/JitsiMeetJS.d.ts index ee9d9767d4..329245d6e1 100644 --- a/types/hand-crafted/JitsiMeetJS.d.ts +++ b/types/hand-crafted/JitsiMeetJS.d.ts @@ -114,7 +114,7 @@ export type JitsiMeetJSType = { setGlobalLogOptions: ( options: unknown ) => void; // TODO: - createLocalTracks: ( options: CreateLocalTracksOptions, firePermissionPromptIsShownEvent?: boolean, originalOptions?: CreateLocalTracksOptions ) => Promise | JitsiConferenceErrors>; // TODO: + createLocalTracks: ( options: CreateLocalTracksOptions, originalOptions?: CreateLocalTracksOptions ) => Promise | JitsiConferenceErrors>; // TODO: createTrackVADEmitter: ( localAudioDeviceId: string, sampleRate: 256 | 512 | 1024 | 4096 | 8192 | 16384, vadProcessor: VADProcessor ) => Promise;