Skip to content

Commit

Permalink
feat(RTC) drop PERMISSION_PROMPT_IS_SHOWN event
Browse files Browse the repository at this point in the history
It was never accurate since browsers have changed their behavior over
time and can be implemented in the application more reliably.
  • Loading branch information
saghul committed Dec 12, 2024
1 parent 1ab4ae5 commit 568973e
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 29 deletions.
13 changes: 2 additions & 11 deletions JitsiMeetJS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();

Expand All @@ -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();

Expand All @@ -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++) {
Expand Down
8 changes: 0 additions & 8 deletions modules/RTC/RTC.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 0 additions & 8 deletions modules/RTC/RTCUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion types/hand-crafted/modules/RTC/RTC.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,5 @@ export default class RTC extends Listenable {
isInForwardedSources: ( sourceName: string ) => boolean;
setReceiverVideoConstraints: ( constraints: unknown ) => void; // TODO:
setVideoMute: ( value: unknown ) => Promise<unknown>; // TODO:
arePermissionsGrantedForAvailableDevices: () => boolean;
sendEndpointStatsMessage: ( payload: unknown ) => void; // TODO:
}
1 change: 0 additions & 1 deletion types/hand-crafted/modules/RTC/RTCUtils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 568973e

Please sign in to comment.