@livekit/react-native 2.7.4 → 2.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,6 +42,8 @@ Object.defineProperty(exports, "getDefaultAppleAudioConfigurationForMode", {
42
42
  }
43
43
  });
44
44
  exports.registerGlobals = registerGlobals;
45
+ require("well-known-symbols/Symbol.asyncIterator/auto");
46
+ require("well-known-symbols/Symbol.iterator/auto");
45
47
  var _reactNativeWebrtc = require("@livekit/react-native-webrtc");
46
48
  var _reactNativeUrlPolyfill = require("react-native-url-polyfill");
47
49
  require("./polyfills/EncoderDecoderTogether.min.js");
@@ -50,6 +52,7 @@ var _reactNative = require("react-native");
50
52
  var _RNE2EEManager = _interopRequireDefault(require("./e2ee/RNE2EEManager"));
51
53
  var _RNKeyProvider = _interopRequireDefault(require("./e2ee/RNKeyProvider"));
52
54
  var _EventEmitter = require("./events/EventEmitter");
55
+ var _webStreamsPolyfill = require("web-streams-polyfill");
53
56
  var _hooks = require("./hooks");
54
57
  Object.keys(_hooks).forEach(function (key) {
55
58
  if (key === "default" || key === "__esModule") return;
@@ -174,8 +177,8 @@ function registerGlobals() {
174
177
  fixWebrtcAdapter();
175
178
  shimPromiseAllSettled();
176
179
  shimArrayAt();
177
- shimAsyncIterator();
178
- shimIterator();
180
+ shimCryptoUuid();
181
+ shimWebstreams();
179
182
  (0, _EventEmitter.setupNativeEvents)();
180
183
  }
181
184
 
@@ -230,13 +233,37 @@ function shimArrayAt() {
230
233
  at.shim();
231
234
  }
232
235
  }
233
- function shimAsyncIterator() {
234
- var shim = require('well-known-symbols/Symbol.asyncIterator/shim');
235
- shim();
236
+ function shimCryptoUuid() {
237
+ var _global$crypto;
238
+ let crypto = global.crypto;
239
+ if (typeof ((_global$crypto = global.crypto) === null || _global$crypto === void 0 ? void 0 : _global$crypto.randomUUID) !== 'function') {
240
+ let createRandomUUID = () => {
241
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
242
+ /* eslint-disable no-bitwise */
243
+ const r = Math.random() * 16 | 0;
244
+ const v = c === 'x' ? r : r & 0x3 | 0x8;
245
+ return v.toString(16);
246
+ });
247
+ };
248
+ if (!crypto) {
249
+ crypto = {};
250
+ global.crypto = crypto;
251
+ }
252
+ crypto.randomUUID = createRandomUUID;
253
+ }
236
254
  }
237
- function shimIterator() {
238
- var shim = require('well-known-symbols/Symbol.iterator/shim');
239
- shim();
255
+ function shimWebstreams() {
256
+ // @ts-expect-error: global.WritableStream isn't typed here.
257
+ if (typeof global.WritableStream === 'undefined') {
258
+ // @ts-expect-error
259
+ global.WritableStream = _webStreamsPolyfill.WritableStream;
260
+ }
261
+
262
+ // @ts-expect-error: global.ReadableStream isn't typed here.
263
+ if (typeof global.ReadableStream === 'undefined') {
264
+ // @ts-expect-error
265
+ global.ReadableStream = _webStreamsPolyfill.ReadableStream;
266
+ }
240
267
  }
241
268
 
242
269
  // deprecated
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNativeWebrtc","require","_reactNativeUrlPolyfill","_AudioSession","_interopRequireWildcard","_reactNative","_RNE2EEManager","_interopRequireDefault","_RNKeyProvider","_EventEmitter","_hooks","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_BarVisualizer","_LiveKitRoom","_VideoTrack","_VideoView","_useParticipant","_useRoom","_logger","_AudioManager","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","registerGlobals","webrtcRegisterGlobals","iosCategoryEnforce","livekitRegisterGlobals","setupURLPolyfill","fixWebrtcAdapter","shimPromiseAllSettled","shimArrayAt","shimAsyncIterator","shimIterator","setupNativeEvents","Platform","OS","getUserMediaFunc","global","navigator","mediaDevices","getUserMedia","constraints","audio","AudioSession","setAppleAudioConfiguration","audioCategory","lkGlobal","platform","devicePixelRatio","PixelRatio","LiveKitReactNativeGlobal","_window","window","undefined","userAgent","product","allSettled","shim","Array","at"],"sources":["index.tsx"],"sourcesContent":["import { registerGlobals as webrtcRegisterGlobals } from '@livekit/react-native-webrtc';\nimport { setupURLPolyfill } from 'react-native-url-polyfill';\nimport './polyfills/EncoderDecoderTogether.min.js';\nimport AudioSession, {\n AndroidAudioTypePresets,\n type AndroidAudioTypeOptions,\n type AppleAudioCategory,\n type AppleAudioCategoryOption,\n type AppleAudioConfiguration,\n type AppleAudioMode,\n type AudioTrackState,\n getDefaultAppleAudioConfigurationForMode,\n} from './audio/AudioSession';\nimport type { AudioConfiguration } from './audio/AudioSession';\nimport { PixelRatio, Platform } from 'react-native';\nimport { type LiveKitReactNativeInfo } from 'livekit-client';\nimport type { LogLevel, SetLogLevelOptions } from './logger';\nimport RNE2EEManager from './e2ee/RNE2EEManager';\nimport RNKeyProvider, { type RNKeyProviderOptions } from './e2ee/RNKeyProvider';\nimport { setupNativeEvents } from './events/EventEmitter';\n\n/**\n * Registers the required globals needed for LiveKit to work.\n *\n * Must be called before using LiveKit.\n */\nexport function registerGlobals() {\n webrtcRegisterGlobals();\n iosCategoryEnforce();\n livekitRegisterGlobals();\n setupURLPolyfill();\n fixWebrtcAdapter();\n shimPromiseAllSettled();\n shimArrayAt();\n shimAsyncIterator();\n shimIterator();\n setupNativeEvents();\n}\n\n/**\n * Enforces changing to playAndRecord category prior to obtaining microphone.\n */\nfunction iosCategoryEnforce() {\n if (Platform.OS === 'ios') {\n // @ts-ignore\n let getUserMediaFunc = global.navigator.mediaDevices.getUserMedia;\n // @ts-ignore\n global.navigator.mediaDevices.getUserMedia = async (constraints: any) => {\n if (constraints.audio) {\n await AudioSession.setAppleAudioConfiguration({\n audioCategory: 'playAndRecord',\n });\n }\n\n return await getUserMediaFunc(constraints);\n };\n }\n}\n\nfunction livekitRegisterGlobals() {\n let lkGlobal: LiveKitReactNativeInfo = {\n platform: Platform.OS,\n devicePixelRatio: PixelRatio.get(),\n };\n\n // @ts-ignore\n global.LiveKitReactNativeGlobal = lkGlobal;\n}\n\nfunction fixWebrtcAdapter() {\n // @ts-ignore\n if (window?.navigator !== undefined) {\n // @ts-ignore\n const { navigator } = window;\n if (navigator.userAgent === undefined) {\n navigator.userAgent = navigator.product ?? 'Unknown';\n }\n }\n}\n\nfunction shimPromiseAllSettled() {\n var allSettled = require('promise.allsettled');\n allSettled.shim();\n}\n\nfunction shimArrayAt() {\n // Some versions of RN don't have Array.prototype.at, which is used by sdp-transform\n if (!Array.prototype.at) {\n var at = require('array.prototype.at');\n at.shim();\n }\n}\n\nfunction shimAsyncIterator() {\n var shim = require('well-known-symbols/Symbol.asyncIterator/shim');\n shim();\n}\n\nfunction shimIterator() {\n var shim = require('well-known-symbols/Symbol.iterator/shim');\n shim();\n}\nexport * from './hooks';\nexport * from './components/BarVisualizer';\nexport * from './components/LiveKitRoom';\nexport * from './components/VideoTrack';\nexport * from './components/VideoView'; // deprecated\nexport * from './useParticipant'; // deprecated\nexport * from './useRoom'; // deprecated\nexport * from './logger';\nexport * from './audio/AudioManager';\n\nexport {\n AudioSession,\n RNE2EEManager,\n RNKeyProvider,\n AndroidAudioTypePresets,\n getDefaultAppleAudioConfigurationForMode,\n};\nexport type {\n AudioConfiguration,\n AndroidAudioTypeOptions,\n AppleAudioCategory,\n AppleAudioCategoryOption,\n AppleAudioConfiguration,\n AppleAudioMode,\n AudioTrackState,\n LogLevel,\n SetLogLevelOptions,\n RNKeyProviderOptions,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACAA,OAAA;AACA,IAAAE,aAAA,GAAAC,uBAAA,CAAAH,OAAA;AAWA,IAAAI,YAAA,GAAAJ,OAAA;AAGA,IAAAK,cAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,cAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,aAAA,GAAAR,OA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BAAgB,EAAEC,uBAAU,CAAClD,GAAG,CAAC;EACnC,CAAC;;EAED;EACAsC,MAAM,CAACa,wBAAwB,GAAGJ,QAAQ;AAC5C;AAEA,SAASlB,gBAAgBA,CAAA,EAAG;EAAA,IAAAuB,OAAA;EAC1B;EACA,IAAI,EAAAA,OAAA,GAAAC,MAAM,cAAAD,OAAA,uBAANA,OAAA,CAAQb,SAAS,MAAKe,SAAS,EAAE;IACnC;IACA,MAAM;MAAEf;IAAU,CAAC,GAAGc,MAAM;IAC5B,IAAId,SAAS,CAACgB,SAAS,KAAKD,SAAS,EAAE;MACrCf,SAAS,CAACgB,SAAS,GAAGhB,SAAS,CAACiB,OAAO,IAAI,SAAS;IACtD;EACF;AACF;AAEA,SAAS1B,qBAAqBA,CAAA,EAAG;EAC/B,IAAI2B,UAAU,GAAG9E,OAAO,CAAC,oBAAoB,CAAC;EAC9C8E,UAAU,CAACC,IAAI,CAAC,CAAC;AACnB;AAEA,SAAS3B,WAAWA,CAAA,EAAG;EACrB;EACA,IAAI,CAAC4B,KAAK,CAAClE,SAAS,CAACmE,EAAE,EAAE;IACvB,IAAIA,EAAE,GAAGjF,OAAO,CAAC,oBAAoB,CAAC;IACtCiF,EAAE,CAACF,IAAI,CAAC,CAAC;EACX;AACF;AAEA,SAAS1B,iBAAiBA,CAAA,EAAG;EAC3B,IAAI0B,IAAI,GAAG/E,OAAO,CAAC,8CAA8C,CAAC;EAClE+E,IAAI,CAAC,CAAC;AACR;AAEA,SAASzB,YAAYA,CAAA,EAAG;EACtB,IAAIyB,IAAI,GAAG/E,OAAO,CAAC,yCAAyC,CAAC;EAC7D+E,IAAI,CAAC,CAAC;AACR;;AAKwC;AACN;AACP","ignoreList":[]}
1
+ {"version":3,"names":["require","_reactNativeWebrtc","_reactNativeUrlPolyfill","_AudioSession","_interopRequireWildcard","_reactNative","_RNE2EEManager","_interopRequireDefault","_RNKeyProvider","_EventEmitter","_webStreamsPolyfill","_hooks","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_BarVisualizer","_LiveKitRoom","_VideoTrack","_VideoView","_useParticipant","_useRoom","_logger","_AudioManager","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","registerGlobals","webrtcRegisterGlobals","iosCategoryEnforce","livekitRegisterGlobals","setupURLPolyfill","fixWebrtcAdapter","shimPromiseAllSettled","shimArrayAt","shimCryptoUuid","shimWebstreams","setupNativeEvents","Platform","OS","getUserMediaFunc","global","navigator","mediaDevices","getUserMedia","constraints","audio","AudioSession","setAppleAudioConfiguration","audioCategory","lkGlobal","platform","devicePixelRatio","PixelRatio","LiveKitReactNativeGlobal","_window","window","undefined","userAgent","product","allSettled","shim","Array","at","_global$crypto","crypto","randomUUID","createRandomUUID","replace","c","Math","random","v","toString","WritableStream","ReadableStream"],"sources":["index.tsx"],"sourcesContent":["import 'well-known-symbols/Symbol.asyncIterator/auto';\nimport 'well-known-symbols/Symbol.iterator/auto';\nimport { registerGlobals as webrtcRegisterGlobals } from '@livekit/react-native-webrtc';\nimport { setupURLPolyfill } from 'react-native-url-polyfill';\nimport './polyfills/EncoderDecoderTogether.min.js';\nimport AudioSession, {\n AndroidAudioTypePresets,\n type AndroidAudioTypeOptions,\n type AppleAudioCategory,\n type AppleAudioCategoryOption,\n type AppleAudioConfiguration,\n type AppleAudioMode,\n type AudioTrackState,\n getDefaultAppleAudioConfigurationForMode,\n} from './audio/AudioSession';\nimport type { AudioConfiguration } from './audio/AudioSession';\nimport { PixelRatio, Platform } from 'react-native';\nimport { type LiveKitReactNativeInfo } from 'livekit-client';\nimport type { LogLevel, SetLogLevelOptions } from './logger';\nimport RNE2EEManager from './e2ee/RNE2EEManager';\nimport RNKeyProvider, { type RNKeyProviderOptions } from './e2ee/RNKeyProvider';\nimport { setupNativeEvents } from './events/EventEmitter';\nimport { ReadableStream, WritableStream } from 'web-streams-polyfill';\n\n/**\n * Registers the required globals needed for LiveKit to work.\n *\n * Must be called before using LiveKit.\n */\nexport function registerGlobals() {\n webrtcRegisterGlobals();\n iosCategoryEnforce();\n livekitRegisterGlobals();\n setupURLPolyfill();\n fixWebrtcAdapter();\n shimPromiseAllSettled();\n shimArrayAt();\n shimCryptoUuid();\n shimWebstreams();\n setupNativeEvents();\n}\n\n/**\n * Enforces changing to playAndRecord category prior to obtaining microphone.\n */\nfunction iosCategoryEnforce() {\n if (Platform.OS === 'ios') {\n // @ts-ignore\n let getUserMediaFunc = global.navigator.mediaDevices.getUserMedia;\n // @ts-ignore\n global.navigator.mediaDevices.getUserMedia = async (constraints: any) => {\n if (constraints.audio) {\n await AudioSession.setAppleAudioConfiguration({\n audioCategory: 'playAndRecord',\n });\n }\n\n return await getUserMediaFunc(constraints);\n };\n }\n}\n\nfunction livekitRegisterGlobals() {\n let lkGlobal: LiveKitReactNativeInfo = {\n platform: Platform.OS,\n devicePixelRatio: PixelRatio.get(),\n };\n\n // @ts-ignore\n global.LiveKitReactNativeGlobal = lkGlobal;\n}\n\nfunction fixWebrtcAdapter() {\n // @ts-ignore\n if (window?.navigator !== undefined) {\n // @ts-ignore\n const { navigator } = window;\n if (navigator.userAgent === undefined) {\n navigator.userAgent = navigator.product ?? 'Unknown';\n }\n }\n}\n\nfunction shimPromiseAllSettled() {\n var allSettled = require('promise.allsettled');\n allSettled.shim();\n}\n\nfunction shimArrayAt() {\n // Some versions of RN don't have Array.prototype.at, which is used by sdp-transform\n if (!Array.prototype.at) {\n var at = require('array.prototype.at');\n at.shim();\n }\n}\n\nfunction shimCryptoUuid() {\n let crypto = global.crypto;\n if (typeof global.crypto?.randomUUID !== 'function') {\n let createRandomUUID = () => {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(\n /[xy]/g,\n function (c) {\n /* eslint-disable no-bitwise */\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n }\n ) as `${string}-${string}-${string}-${string}-${string}`;\n };\n\n if (!crypto) {\n crypto = {} as typeof global.crypto;\n global.crypto = crypto;\n }\n crypto.randomUUID = createRandomUUID;\n }\n}\n\nfunction shimWebstreams() {\n // @ts-expect-error: global.WritableStream isn't typed here.\n if (typeof global.WritableStream === 'undefined') {\n // @ts-expect-error\n global.WritableStream = WritableStream;\n }\n\n // @ts-expect-error: global.ReadableStream isn't typed here.\n if (typeof global.ReadableStream === 'undefined') {\n // @ts-expect-error\n global.ReadableStream = ReadableStream;\n }\n}\n\nexport * from './hooks';\nexport * from './components/BarVisualizer';\nexport * from './components/LiveKitRoom';\nexport * from './components/VideoTrack';\nexport * from './components/VideoView'; // deprecated\nexport * from './useParticipant'; // deprecated\nexport * from './useRoom'; // deprecated\nexport * from './logger';\nexport * from './audio/AudioManager';\n\nexport {\n AudioSession,\n RNE2EEManager,\n RNKeyProvider,\n AndroidAudioTypePresets,\n getDefaultAppleAudioConfigurationForMode,\n};\nexport type {\n AudioConfiguration,\n AndroidAudioTypeOptions,\n AppleAudioCategory,\n AppleAudioCategoryOption,\n AppleAudioConfiguration,\n AppleAudioMode,\n AudioTrackState,\n LogLevel,\n SetLogLevelOptions,\n RNKeyProviderOptions,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AACAA,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AACAA,OAAA;AACA,IAAAG,aAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAWA,IAAAK,YAAA,GAAAL,OAAA;AAGA,IAAAM,cAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,mBAAA,GAAAV,OAAA;AA+GA,IAAAW,MAAA,GAAAX,OAAA;AAAAY,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,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AACC,QAAQ,CAAC,EAAE,CAAC;MACvB,CACF,CAAC;IACH,CAAC;IAED,IAAI,CAACR,MAAM,EAAE;MACXA,MAAM,GAAG,CAAC,CAAyB;MACnCxB,MAAM,CAACwB,MAAM,GAAGA,MAAM;IACxB;IACAA,MAAM,CAACC,UAAU,GAAGC,gBAAgB;EACtC;AACF;AAEA,SAAS/B,cAAcA,CAAA,EAAG;EACxB;EACA,IAAI,OAAOK,MAAM,CAACiC,cAAc,KAAK,WAAW,EAAE;IAChD;IACAjC,MAAM,CAACiC,cAAc,GAAGA,kCAAc;EACxC;;EAEA;EACA,IAAI,OAAOjC,MAAM,CAACkC,cAAc,KAAK,WAAW,EAAE;IAChD;IACAlC,MAAM,CAACkC,cAAc,GAAGA,kCAAc;EACxC;AACF;;AAMwC;AACN;AACP","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ import 'well-known-symbols/Symbol.asyncIterator/auto';
2
+ import 'well-known-symbols/Symbol.iterator/auto';
1
3
  import { registerGlobals as webrtcRegisterGlobals } from '@livekit/react-native-webrtc';
2
4
  import { setupURLPolyfill } from 'react-native-url-polyfill';
3
5
  import './polyfills/EncoderDecoderTogether.min.js';
@@ -6,6 +8,7 @@ import { PixelRatio, Platform } from 'react-native';
6
8
  import RNE2EEManager from './e2ee/RNE2EEManager';
7
9
  import RNKeyProvider from './e2ee/RNKeyProvider';
8
10
  import { setupNativeEvents } from './events/EventEmitter';
11
+ import { ReadableStream, WritableStream } from 'web-streams-polyfill';
9
12
 
10
13
  /**
11
14
  * Registers the required globals needed for LiveKit to work.
@@ -20,8 +23,8 @@ export function registerGlobals() {
20
23
  fixWebrtcAdapter();
21
24
  shimPromiseAllSettled();
22
25
  shimArrayAt();
23
- shimAsyncIterator();
24
- shimIterator();
26
+ shimCryptoUuid();
27
+ shimWebstreams();
25
28
  setupNativeEvents();
26
29
  }
27
30
 
@@ -76,13 +79,37 @@ function shimArrayAt() {
76
79
  at.shim();
77
80
  }
78
81
  }
79
- function shimAsyncIterator() {
80
- var shim = require('well-known-symbols/Symbol.asyncIterator/shim');
81
- shim();
82
+ function shimCryptoUuid() {
83
+ var _global$crypto;
84
+ let crypto = global.crypto;
85
+ if (typeof ((_global$crypto = global.crypto) === null || _global$crypto === void 0 ? void 0 : _global$crypto.randomUUID) !== 'function') {
86
+ let createRandomUUID = () => {
87
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
88
+ /* eslint-disable no-bitwise */
89
+ const r = Math.random() * 16 | 0;
90
+ const v = c === 'x' ? r : r & 0x3 | 0x8;
91
+ return v.toString(16);
92
+ });
93
+ };
94
+ if (!crypto) {
95
+ crypto = {};
96
+ global.crypto = crypto;
97
+ }
98
+ crypto.randomUUID = createRandomUUID;
99
+ }
82
100
  }
83
- function shimIterator() {
84
- var shim = require('well-known-symbols/Symbol.iterator/shim');
85
- shim();
101
+ function shimWebstreams() {
102
+ // @ts-expect-error: global.WritableStream isn't typed here.
103
+ if (typeof global.WritableStream === 'undefined') {
104
+ // @ts-expect-error
105
+ global.WritableStream = WritableStream;
106
+ }
107
+
108
+ // @ts-expect-error: global.ReadableStream isn't typed here.
109
+ if (typeof global.ReadableStream === 'undefined') {
110
+ // @ts-expect-error
111
+ global.ReadableStream = ReadableStream;
112
+ }
86
113
  }
87
114
  export * from './hooks';
88
115
  export * from './components/BarVisualizer';
@@ -1 +1 @@
1
- {"version":3,"names":["registerGlobals","webrtcRegisterGlobals","setupURLPolyfill","AudioSession","AndroidAudioTypePresets","getDefaultAppleAudioConfigurationForMode","PixelRatio","Platform","RNE2EEManager","RNKeyProvider","setupNativeEvents","iosCategoryEnforce","livekitRegisterGlobals","fixWebrtcAdapter","shimPromiseAllSettled","shimArrayAt","shimAsyncIterator","shimIterator","OS","getUserMediaFunc","global","navigator","mediaDevices","getUserMedia","constraints","audio","setAppleAudioConfiguration","audioCategory","lkGlobal","platform","devicePixelRatio","get","LiveKitReactNativeGlobal","_window","window","undefined","userAgent","product","allSettled","require","shim","Array","prototype","at"],"sources":["index.tsx"],"sourcesContent":["import { registerGlobals as webrtcRegisterGlobals } from '@livekit/react-native-webrtc';\nimport { setupURLPolyfill } from 'react-native-url-polyfill';\nimport './polyfills/EncoderDecoderTogether.min.js';\nimport AudioSession, {\n AndroidAudioTypePresets,\n type AndroidAudioTypeOptions,\n type AppleAudioCategory,\n type AppleAudioCategoryOption,\n type AppleAudioConfiguration,\n type AppleAudioMode,\n type AudioTrackState,\n getDefaultAppleAudioConfigurationForMode,\n} from './audio/AudioSession';\nimport type { AudioConfiguration } from './audio/AudioSession';\nimport { PixelRatio, Platform } from 'react-native';\nimport { type LiveKitReactNativeInfo } from 'livekit-client';\nimport type { LogLevel, SetLogLevelOptions } from './logger';\nimport RNE2EEManager from './e2ee/RNE2EEManager';\nimport RNKeyProvider, { type RNKeyProviderOptions } from './e2ee/RNKeyProvider';\nimport { setupNativeEvents } from './events/EventEmitter';\n\n/**\n * Registers the required globals needed for LiveKit to work.\n *\n * Must be called before using LiveKit.\n */\nexport function registerGlobals() {\n webrtcRegisterGlobals();\n iosCategoryEnforce();\n livekitRegisterGlobals();\n setupURLPolyfill();\n fixWebrtcAdapter();\n shimPromiseAllSettled();\n shimArrayAt();\n shimAsyncIterator();\n shimIterator();\n setupNativeEvents();\n}\n\n/**\n * Enforces changing to playAndRecord category prior to obtaining microphone.\n */\nfunction iosCategoryEnforce() {\n if (Platform.OS === 'ios') {\n // @ts-ignore\n let getUserMediaFunc = global.navigator.mediaDevices.getUserMedia;\n // @ts-ignore\n global.navigator.mediaDevices.getUserMedia = async (constraints: any) => {\n if (constraints.audio) {\n await AudioSession.setAppleAudioConfiguration({\n audioCategory: 'playAndRecord',\n });\n }\n\n return await getUserMediaFunc(constraints);\n };\n }\n}\n\nfunction livekitRegisterGlobals() {\n let lkGlobal: LiveKitReactNativeInfo = {\n platform: Platform.OS,\n devicePixelRatio: PixelRatio.get(),\n };\n\n // @ts-ignore\n global.LiveKitReactNativeGlobal = lkGlobal;\n}\n\nfunction fixWebrtcAdapter() {\n // @ts-ignore\n if (window?.navigator !== undefined) {\n // @ts-ignore\n const { navigator } = window;\n if (navigator.userAgent === undefined) {\n navigator.userAgent = navigator.product ?? 'Unknown';\n }\n }\n}\n\nfunction shimPromiseAllSettled() {\n var allSettled = require('promise.allsettled');\n allSettled.shim();\n}\n\nfunction shimArrayAt() {\n // Some versions of RN don't have Array.prototype.at, which is used by sdp-transform\n if (!Array.prototype.at) {\n var at = require('array.prototype.at');\n at.shim();\n }\n}\n\nfunction shimAsyncIterator() {\n var shim = require('well-known-symbols/Symbol.asyncIterator/shim');\n shim();\n}\n\nfunction shimIterator() {\n var shim = require('well-known-symbols/Symbol.iterator/shim');\n shim();\n}\nexport * from './hooks';\nexport * from './components/BarVisualizer';\nexport * from './components/LiveKitRoom';\nexport * from './components/VideoTrack';\nexport * from './components/VideoView'; // deprecated\nexport * from './useParticipant'; // deprecated\nexport * from './useRoom'; // deprecated\nexport * from './logger';\nexport * from './audio/AudioManager';\n\nexport {\n AudioSession,\n RNE2EEManager,\n RNKeyProvider,\n AndroidAudioTypePresets,\n getDefaultAppleAudioConfigurationForMode,\n};\nexport type {\n AudioConfiguration,\n AndroidAudioTypeOptions,\n AppleAudioCategory,\n AppleAudioCategoryOption,\n AppleAudioConfiguration,\n AppleAudioMode,\n AudioTrackState,\n LogLevel,\n SetLogLevelOptions,\n RNKeyProviderOptions,\n};\n"],"mappings":"AAAA,SAASA,eAAe,IAAIC,qBAAqB,QAAQ,8BAA8B;AACvF,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAO,2CAA2C;AAClD,OAAOC,YAAY,IACjBC,uBAAuB,EAOvBC,wCAAwC,QACnC,sBAAsB;AAE7B,SAASC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AAGnD,OAAOC,aAAa,MAAM,sBAAsB;AAChD,OAAOC,aAAa,MAAqC,sBAAsB;AAC/E,SAASC,iBAAiB,QAAQ,uBAAuB;;A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AAS,CAACe,SAAS,KAAKD,SAAS,EAAE;MACrCd,SAAS,CAACe,SAAS,GAAGf,SAAS,CAACgB,OAAO,IAAI,SAAS;IACtD;EACF;AACF;AAEA,SAASvB,qBAAqBA,CAAA,EAAG;EAC/B,IAAIwB,UAAU,GAAGC,OAAO,CAAC,oBAAoB,CAAC;EAC9CD,UAAU,CAACE,IAAI,CAAC,CAAC;AACnB;AAEA,SAASzB,WAAWA,CAAA,EAAG;EACrB;EACA,IAAI,CAAC0B,KAAK,CAACC,SAAS,CAACC,EAAE,EAAE;IACvB,IAAIA,EAAE,GAAGJ,OAAO,CAAC,oBAAoB,CAAC;IACtCI,EAAE,CAACH,IAAI,CAAC,CAAC;EACX;AACF;AAEA,SAASxB,iBAAiBA,CAAA,EAAG;EAC3B,IAAIwB,IAAI,GAAGD,OAAO,CAAC,8CAA8C,CAAC;EAClEC,IAAI,CAAC,CAAC;AACR;AAEA,SAASvB,YAAYA,CAAA,EAAG;EACtB,IAAIuB,IAAI,GAAGD,OAAO,CAAC,yCAAyC,CAAC;EAC7DC,IAAI,CAAC,CAAC;AACR;AACA,cAAc,SAAS;AACvB,cAAc,4BAA4B;AAC1C,cAAc,0BAA0B;AACxC,cAAc,yBAAyB;AACvC,cAAc,wBAAwB,CAAC,CAAC;AACxC,cAAc,kBAAkB,CAAC,CAAC;AAClC,cAAc,WAAW,CAAC,CAAC;AAC3B,cAAc,UAAU;AACxB,cAAc,sBAAsB;AAEpC,SACErC,YAAY,EACZK,aAAa,EACbC,aAAa,EACbL,uBAAuB,EACvBC,wCAAwC","ignoreList":[]}
1
+ {"version":3,"names":["registerGlobals","webrtcRegisterGlobals","setupURLPolyfill","AudioSession","AndroidAudioTypePresets","getDefaultAppleAudioConfigurationForMode","PixelRatio","Platform","RNE2EEManager","RNKeyProvider","setupNativeEvents","ReadableStream","WritableStream","iosCategoryEnforce","livekitRegisterGlobals","fixWebrtcAdapter","shimPromiseAllSettled","shimArrayAt","shimCryptoUuid","shimWebstreams","OS","getUserMediaFunc","global","navigator","mediaDevices","getUserMedia","constraints","audio","setAppleAudioConfiguration","audioCategory","lkGlobal","platform","devicePixelRatio","get","LiveKitReactNativeGlobal","_window","window","undefined","userAgent","product","allSettled","require","shim","Array","prototype","at","_global$crypto","crypto","randomUUID","createRandomUUID","replace","c","r","Math","random","v","toString"],"sources":["index.tsx"],"sourcesContent":["import 'well-known-symbols/Symbol.asyncIterator/auto';\nimport 'well-known-symbols/Symbol.iterator/auto';\nimport { registerGlobals as webrtcRegisterGlobals } from '@livekit/react-native-webrtc';\nimport { setupURLPolyfill } from 'react-native-url-polyfill';\nimport './polyfills/EncoderDecoderTogether.min.js';\nimport AudioSession, {\n AndroidAudioTypePresets,\n type AndroidAudioTypeOptions,\n type AppleAudioCategory,\n type AppleAudioCategoryOption,\n type AppleAudioConfiguration,\n type AppleAudioMode,\n type AudioTrackState,\n getDefaultAppleAudioConfigurationForMode,\n} from './audio/AudioSession';\nimport type { AudioConfiguration } from './audio/AudioSession';\nimport { PixelRatio, Platform } from 'react-native';\nimport { type LiveKitReactNativeInfo } from 'livekit-client';\nimport type { LogLevel, SetLogLevelOptions } from './logger';\nimport RNE2EEManager from './e2ee/RNE2EEManager';\nimport RNKeyProvider, { type RNKeyProviderOptions } from './e2ee/RNKeyProvider';\nimport { setupNativeEvents } from './events/EventEmitter';\nimport { ReadableStream, WritableStream } from 'web-streams-polyfill';\n\n/**\n * Registers the required globals needed for LiveKit to work.\n *\n * Must be called before using LiveKit.\n */\nexport function registerGlobals() {\n webrtcRegisterGlobals();\n iosCategoryEnforce();\n livekitRegisterGlobals();\n setupURLPolyfill();\n fixWebrtcAdapter();\n shimPromiseAllSettled();\n shimArrayAt();\n shimCryptoUuid();\n shimWebstreams();\n setupNativeEvents();\n}\n\n/**\n * Enforces changing to playAndRecord category prior to obtaining microphone.\n */\nfunction iosCategoryEnforce() {\n if (Platform.OS === 'ios') {\n // @ts-ignore\n let getUserMediaFunc = global.navigator.mediaDevices.getUserMedia;\n // @ts-ignore\n global.navigator.mediaDevices.getUserMedia = async (constraints: any) => {\n if (constraints.audio) {\n await AudioSession.setAppleAudioConfiguration({\n audioCategory: 'playAndRecord',\n });\n }\n\n return await getUserMediaFunc(constraints);\n };\n }\n}\n\nfunction livekitRegisterGlobals() {\n let lkGlobal: LiveKitReactNativeInfo = {\n platform: Platform.OS,\n devicePixelRatio: PixelRatio.get(),\n };\n\n // @ts-ignore\n global.LiveKitReactNativeGlobal = lkGlobal;\n}\n\nfunction fixWebrtcAdapter() {\n // @ts-ignore\n if (window?.navigator !== undefined) {\n // @ts-ignore\n const { navigator } = window;\n if (navigator.userAgent === undefined) {\n navigator.userAgent = navigator.product ?? 'Unknown';\n }\n }\n}\n\nfunction shimPromiseAllSettled() {\n var allSettled = require('promise.allsettled');\n allSettled.shim();\n}\n\nfunction shimArrayAt() {\n // Some versions of RN don't have Array.prototype.at, which is used by sdp-transform\n if (!Array.prototype.at) {\n var at = require('array.prototype.at');\n at.shim();\n }\n}\n\nfunction shimCryptoUuid() {\n let crypto = global.crypto;\n if (typeof global.crypto?.randomUUID !== 'function') {\n let createRandomUUID = () => {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(\n /[xy]/g,\n function (c) {\n /* eslint-disable no-bitwise */\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n }\n ) as `${string}-${string}-${string}-${string}-${string}`;\n };\n\n if (!crypto) {\n crypto = {} as typeof global.crypto;\n global.crypto = crypto;\n }\n crypto.randomUUID = createRandomUUID;\n }\n}\n\nfunction shimWebstreams() {\n // @ts-expect-error: global.WritableStream isn't typed here.\n if (typeof global.WritableStream === 'undefined') {\n // @ts-expect-error\n global.WritableStream = WritableStream;\n }\n\n // @ts-expect-error: global.ReadableStream isn't typed here.\n if (typeof global.ReadableStream === 'undefined') {\n // @ts-expect-error\n global.ReadableStream = ReadableStream;\n }\n}\n\nexport * from './hooks';\nexport * from './components/BarVisualizer';\nexport * from './components/LiveKitRoom';\nexport * from './components/VideoTrack';\nexport * from './components/VideoView'; // deprecated\nexport * from './useParticipant'; // deprecated\nexport * from './useRoom'; // deprecated\nexport * from './logger';\nexport * from './audio/AudioManager';\n\nexport {\n AudioSession,\n RNE2EEManager,\n RNKeyProvider,\n AndroidAudioTypePresets,\n getDefaultAppleAudioConfigurationForMode,\n};\nexport type {\n AudioConfiguration,\n AndroidAudioTypeOptions,\n AppleAudioCategory,\n AppleAudioCategoryOption,\n AppleAudioConfiguration,\n AppleAudioMode,\n AudioTrackState,\n LogLevel,\n SetLogLevelOptions,\n RNKeyProviderOptions,\n};\n"],"mappings":"AAAA,OAAO,8CAA8C;AACrD,OAAO,yCAAyC;AAChD,SAASA,eAAe,IAAIC,qBAAqB,QAAQ,8BAA8B;AACvF,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAO,2CAA2C;AAClD,OAAOC,YAAY,IACjBC,uBAAuB,EAOvBC,wCAAwC,QACnC,sBAAsB;AAE7B,SAASC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AAGnD,OAAOC,aAAa,MAAM,sBAAsB;AAChD,OAAOC,aAAa,MAAqC,sBAAsB;AAC/E,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,cAAc,EAAEC,cAAc,QAAQ,sBAAsB;;AAErE;AACA;AACA;AACA;AACA;AACA,OAAO,SAASZ,eAAeA,CAAA,EAAG;EAChCC,qBAAqB,CAAC,CAAC;EACvBY,kBAAkB,CAAC,CAAC;EACpBC,sBAAsB,CAAC,CAAC;EACxBZ,gBAAgB,CAAC,CAAC;EAClBa,gBAAgB,CAAC,CAAC;EAClBC,qBAAqB,CAAC,CAAC;EACvBC,WAAW,CAAC,CAAC;EACbC,cAAc,CAAC,CAAC;EAChBC,cAAc,CAAC,CAAC;EAChBT,iBAAiB,CAAC,CAAC;AACrB;;AAEA;AACA;AACA;AACA,SAASG,kBAAkBA,CAAA,EAAG;EAC5B,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,cAAc,UAAU;AACxB,cAAc,sBAAsB;AAEpC,SACER,YAAY,EACZK,aAAa,EACbC,aAAa,EACbL,uBAAuB,EACvBC,wCAAwC","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ import 'well-known-symbols/Symbol.asyncIterator/auto';
2
+ import 'well-known-symbols/Symbol.iterator/auto';
1
3
  import './polyfills/EncoderDecoderTogether.min.js';
2
4
  import AudioSession, { AndroidAudioTypePresets, type AndroidAudioTypeOptions, type AppleAudioCategory, type AppleAudioCategoryOption, type AppleAudioConfiguration, type AppleAudioMode, type AudioTrackState, getDefaultAppleAudioConfigurationForMode } from './audio/AudioSession';
3
5
  import type { AudioConfiguration } from './audio/AudioSession';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livekit/react-native",
3
- "version": "2.7.4",
3
+ "version": "2.7.5",
4
4
  "description": "LiveKit for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -49,7 +49,8 @@
49
49
  "promise.allsettled": "^1.0.5",
50
50
  "react-native-url-polyfill": "^1.3.0",
51
51
  "typed-emitter": "^2.1.0",
52
- "well-known-symbols": "^4.0.0"
52
+ "web-streams-polyfill": "^4.1.0",
53
+ "well-known-symbols": "^4.1.0"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@babel/core": "^7.20.0",
package/src/index.tsx CHANGED
@@ -1,3 +1,5 @@
1
+ import 'well-known-symbols/Symbol.asyncIterator/auto';
2
+ import 'well-known-symbols/Symbol.iterator/auto';
1
3
  import { registerGlobals as webrtcRegisterGlobals } from '@livekit/react-native-webrtc';
2
4
  import { setupURLPolyfill } from 'react-native-url-polyfill';
3
5
  import './polyfills/EncoderDecoderTogether.min.js';
@@ -18,6 +20,7 @@ import type { LogLevel, SetLogLevelOptions } from './logger';
18
20
  import RNE2EEManager from './e2ee/RNE2EEManager';
19
21
  import RNKeyProvider, { type RNKeyProviderOptions } from './e2ee/RNKeyProvider';
20
22
  import { setupNativeEvents } from './events/EventEmitter';
23
+ import { ReadableStream, WritableStream } from 'web-streams-polyfill';
21
24
 
22
25
  /**
23
26
  * Registers the required globals needed for LiveKit to work.
@@ -32,8 +35,8 @@ export function registerGlobals() {
32
35
  fixWebrtcAdapter();
33
36
  shimPromiseAllSettled();
34
37
  shimArrayAt();
35
- shimAsyncIterator();
36
- shimIterator();
38
+ shimCryptoUuid();
39
+ shimWebstreams();
37
40
  setupNativeEvents();
38
41
  }
39
42
 
@@ -91,15 +94,43 @@ function shimArrayAt() {
91
94
  }
92
95
  }
93
96
 
94
- function shimAsyncIterator() {
95
- var shim = require('well-known-symbols/Symbol.asyncIterator/shim');
96
- shim();
97
+ function shimCryptoUuid() {
98
+ let crypto = global.crypto;
99
+ if (typeof global.crypto?.randomUUID !== 'function') {
100
+ let createRandomUUID = () => {
101
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
102
+ /[xy]/g,
103
+ function (c) {
104
+ /* eslint-disable no-bitwise */
105
+ const r = (Math.random() * 16) | 0;
106
+ const v = c === 'x' ? r : (r & 0x3) | 0x8;
107
+ return v.toString(16);
108
+ }
109
+ ) as `${string}-${string}-${string}-${string}-${string}`;
110
+ };
111
+
112
+ if (!crypto) {
113
+ crypto = {} as typeof global.crypto;
114
+ global.crypto = crypto;
115
+ }
116
+ crypto.randomUUID = createRandomUUID;
117
+ }
97
118
  }
98
119
 
99
- function shimIterator() {
100
- var shim = require('well-known-symbols/Symbol.iterator/shim');
101
- shim();
120
+ function shimWebstreams() {
121
+ // @ts-expect-error: global.WritableStream isn't typed here.
122
+ if (typeof global.WritableStream === 'undefined') {
123
+ // @ts-expect-error
124
+ global.WritableStream = WritableStream;
125
+ }
126
+
127
+ // @ts-expect-error: global.ReadableStream isn't typed here.
128
+ if (typeof global.ReadableStream === 'undefined') {
129
+ // @ts-expect-error
130
+ global.ReadableStream = ReadableStream;
131
+ }
102
132
  }
133
+
103
134
  export * from './hooks';
104
135
  export * from './components/BarVisualizer';
105
136
  export * from './components/LiveKitRoom';