File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,14 +24,34 @@ import RNKeyProvider, { type RNKeyProviderOptions } from './e2ee/RNKeyProvider';
2424import { setupNativeEvents } from './events/EventEmitter' ;
2525import { ReadableStream , WritableStream } from 'web-streams-polyfill' ;
2626
27+ export interface RegisterGlobalsOptions {
28+ /**
29+ * Automatically configure audio session before accessing microphone.
30+ * When enabled, sets the iOS audio category to 'playAndRecord' before getUserMedia.
31+ *
32+ * @default true
33+ * @platform ios
34+ */
35+ autoConfigureAudioSession ?: boolean ;
36+ }
37+
2738/**
2839 * Registers the required globals needed for LiveKit to work.
2940 *
3041 * Must be called before using LiveKit.
42+ *
43+ * @param options Optional configuration for global registration
3144 */
32- export function registerGlobals ( ) {
45+ export function registerGlobals ( options ?: RegisterGlobalsOptions ) {
46+ const opts = {
47+ autoConfigureAudioSession : true ,
48+ ...options ,
49+ } ;
50+
3351 webrtcRegisterGlobals ( ) ;
34- iosCategoryEnforce ( ) ;
52+ if ( opts . autoConfigureAudioSession ) {
53+ iosCategoryEnforce ( ) ;
54+ }
3555 livekitRegisterGlobals ( ) ;
3656 setupURLPolyfill ( ) ;
3757 fixWebrtcAdapter ( ) ;
@@ -161,4 +181,5 @@ export type {
161181 LogLevel ,
162182 SetLogLevelOptions ,
163183 RNKeyProviderOptions ,
184+ RegisterGlobalsOptions ,
164185} ;
You can’t perform that action at this time.
0 commit comments