From d7dc753db46fbdf904cdd6ce9a28f0f010d34c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 13 Dec 2024 20:30:32 +0100 Subject: [PATCH] feat(RTC) drop PERMISSION_PROMPT_IS_SHOWN event (#2609) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. * squash: Update JitsiMeetJS.ts * squash: Update hand-crafted JitsiMeetJS.d.ts --------- Co-authored-by: Дамян Минков --- JitsiMeetJS.ts | 14 ++------------ modules/RTC/RTC.js | 8 -------- modules/RTC/RTCUtils.js | 8 -------- types/hand-crafted/JitsiMeetJS.d.ts | 2 +- types/hand-crafted/modules/RTC/RTC.d.ts | 1 - types/hand-crafted/modules/RTC/RTCUtils.d.ts | 1 - 6 files changed, 3 insertions(+), 31 deletions(-) diff --git a/JitsiMeetJS.ts b/JitsiMeetJS.ts index 78b3c434ec..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; @@ -273,8 +272,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 +282,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 +296,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 +309,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/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; 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; }