Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RTC) drop PERMISSION_PROMPT_IS_SHOWN event #2609

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions JitsiMeetJS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ function getAnalyticsAttributesFromOptions(options) {
interface ICreateLocalTrackOptions {
cameraDeviceId?: string;
devices?: any[];
firePermissionPromptIsShownEvent?: boolean;
fireSlowPromiseEvent?: boolean;
micDeviceId?: string;
resolution?: string;
Expand Down Expand Up @@ -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
Expand All @@ -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();

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

Expand All @@ -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++) {
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
2 changes: 1 addition & 1 deletion types/hand-crafted/JitsiMeetJS.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export type JitsiMeetJSType = {

setGlobalLogOptions: ( options: unknown ) => void; // TODO:

createLocalTracks: ( options: CreateLocalTracksOptions, firePermissionPromptIsShownEvent?: boolean, originalOptions?: CreateLocalTracksOptions ) => Promise<Array<JitsiLocalTrack> | JitsiConferenceErrors>; // TODO:
createLocalTracks: ( options: CreateLocalTracksOptions, originalOptions?: CreateLocalTracksOptions ) => Promise<Array<JitsiLocalTrack> | JitsiConferenceErrors>; // TODO:

createTrackVADEmitter: ( localAudioDeviceId: string, sampleRate: 256 | 512 | 1024 | 4096 | 8192 | 16384, vadProcessor: VADProcessor ) => Promise<TrackVADEmitter>;

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
Loading