Skip to content

Commit

Permalink
permission fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO committed Jan 9, 2025
1 parent df708d1 commit d0cd845
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion examples/demo/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import {
} from '../../src/index';
import { isSVCCodec } from '../../src/room/utils';

setLogLevel(LogLevel.debug);

const $ = <T extends HTMLElement>(id: string) => document.getElementById(id) as T;

const state = {
Expand Down Expand Up @@ -85,7 +87,6 @@ const appActions = {
const e2eeEnabled = (<HTMLInputElement>$('e2ee')).checked;
const audioOutputId = (<HTMLSelectElement>$('audio-output')).value;

setLogLevel(LogLevel.debug);
updateSearchParams(url, token, cryptoKey);

const roomOpts: RoomOptions = {
Expand Down Expand Up @@ -883,6 +884,7 @@ async function handleDevicesChanged() {
}

async function handleActiveDeviceChanged(kind: MediaDeviceKind, deviceId: string) {
console.debug('active device changed', kind, deviceId);
state.defaultDevices.set(kind, deviceId);
const devices = await Room.getLocalDevices(kind);
const element = <HTMLSelectElement>$(
Expand Down
2 changes: 1 addition & 1 deletion src/room/DeviceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class DeviceManager {
if (isDummyDeviceOrEmpty) {
const permissionsToAcquire = {
video: kind !== 'audioinput' && kind !== 'audiooutput',
audio: kind !== 'videoinput',
audio: kind !== 'videoinput' && { deviceId: 'default' },
};
const stream = await navigator.mediaDevices.getUserMedia(permissionsToAcquire);
devices = await navigator.mediaDevices.enumerateDevices();
Expand Down
2 changes: 0 additions & 2 deletions src/room/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
typeof FinalizationRegistry !== 'undefined' &&
new FinalizationRegistry((cleanup: () => void) => {
cleanup();
console.info('cleaning up room');
});

/**
Expand Down Expand Up @@ -1678,7 +1677,6 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
const previousDevices = DeviceManager.getInstance().previousDevices;
// check for available devices, but don't request permissions in order to avoid prompts for kinds that haven't been used before
const availableDevices = await DeviceManager.getInstance().getDevices(undefined, false);

const browser = getBrowser();
if (browser?.name === 'Chrome' && browser.os !== 'iOS') {
for (let availableDevice of availableDevices) {
Expand Down

0 comments on commit d0cd845

Please sign in to comment.