Skip to content

Commit 3956b85

Browse files
authored
Add debug logs for cam switching (#216)
* log more * use logger
1 parent 4c5f00c commit 3956b85

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/core/src/components/mediaDeviceSelect.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { LocalAudioTrack, LocalVideoTrack, Room } from 'livekit-client';
22
import { BehaviorSubject, map, mergeWith } from 'rxjs';
3+
import log from '../logger';
34
import { observeParticipantMedia } from '../observables/participant';
45
import { lkClassName } from '../utils';
56

@@ -29,7 +30,10 @@ export function setupDeviceSelector(kind: MediaDeviceKind, room?: Room) {
2930

3031
const setActiveMediaDevice = async (id: string) => {
3132
if (room) {
32-
await room?.switchActiveDevice(kind, id);
33+
log.debug('switching device', kind, id);
34+
await room.switchActiveDevice(kind, id);
35+
} else {
36+
log.debug('room not available, skipping device switch');
3337
}
3438
activeDeviceSubject.next(id);
3539
};

packages/core/src/logger.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { getLogger } from 'loglevel';
22

33
const log = getLogger('lk-components-js');
4+
log.setDefaultLevel('DEBUG');
45

56
export default log;

0 commit comments

Comments
 (0)