@voltkit-rtc/react-native 0.0.0-stage → 0.1.1

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.
Files changed (225) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1608 -2
  4. package/android/build.gradle +70 -0
  5. package/android/consumer-rules.pro +21 -0
  6. package/android/src/main/AndroidManifest.xml +25 -0
  7. package/android/src/main/java/com/voltkit/rtc/reactnative/AppVisibility.kt +67 -0
  8. package/android/src/main/java/com/voltkit/rtc/reactnative/AudioDevices.kt +67 -0
  9. package/android/src/main/java/com/voltkit/rtc/reactnative/AudioRouter.kt +487 -0
  10. package/android/src/main/java/com/voltkit/rtc/reactnative/CallServiceTypes.kt +120 -0
  11. package/android/src/main/java/com/voltkit/rtc/reactnative/NativeTimers.kt +106 -0
  12. package/android/src/main/java/com/voltkit/rtc/reactnative/NetworkWatch.kt +120 -0
  13. package/android/src/main/java/com/voltkit/rtc/reactnative/OutputChoice.kt +65 -0
  14. package/android/src/main/java/com/voltkit/rtc/reactnative/RtcConfig.kt +83 -0
  15. package/android/src/main/java/com/voltkit/rtc/reactnative/ScoLink.kt +61 -0
  16. package/android/src/main/java/com/voltkit/rtc/reactnative/VoltkitCallService.kt +287 -0
  17. package/android/src/main/java/com/voltkit/rtc/reactnative/VoltkitRtcInitProvider.kt +215 -0
  18. package/android/src/main/java/com/voltkit/rtc/reactnative/VoltkitRtcModule.kt +313 -0
  19. package/android/src/main/java/com/voltkit/rtc/reactnative/VoltkitRtcPackage.kt +30 -0
  20. package/android/src/main/res/drawable/voltkit_rtc_default_call_icon.xml +15 -0
  21. package/android/src/main/res/raw/voltkit_rtc_keep.xml +7 -0
  22. package/app.plugin.js +17 -0
  23. package/lib/commonjs/audio.js +215 -0
  24. package/lib/commonjs/audio.js.map +1 -0
  25. package/lib/commonjs/components.js +207 -0
  26. package/lib/commonjs/components.js.map +1 -0
  27. package/lib/commonjs/create-client.js +47 -0
  28. package/lib/commonjs/create-client.js.map +1 -0
  29. package/lib/commonjs/errors.js +99 -0
  30. package/lib/commonjs/errors.js.map +1 -0
  31. package/lib/commonjs/globals.js +61 -0
  32. package/lib/commonjs/globals.js.map +1 -0
  33. package/lib/commonjs/index.js +234 -0
  34. package/lib/commonjs/index.js.map +1 -0
  35. package/lib/commonjs/local-media.js +392 -0
  36. package/lib/commonjs/local-media.js.map +1 -0
  37. package/lib/commonjs/native-session.js +365 -0
  38. package/lib/commonjs/native-session.js.map +1 -0
  39. package/lib/commonjs/native.js +99 -0
  40. package/lib/commonjs/native.js.map +1 -0
  41. package/lib/commonjs/package.json +1 -0
  42. package/lib/commonjs/permissions.js +166 -0
  43. package/lib/commonjs/permissions.js.map +1 -0
  44. package/lib/commonjs/platform/android.js +126 -0
  45. package/lib/commonjs/platform/android.js.map +1 -0
  46. package/lib/commonjs/platform/common.js +138 -0
  47. package/lib/commonjs/platform/common.js.map +1 -0
  48. package/lib/commonjs/platform/devices.js +151 -0
  49. package/lib/commonjs/platform/devices.js.map +1 -0
  50. package/lib/commonjs/platform/index.js +35 -0
  51. package/lib/commonjs/platform/index.js.map +1 -0
  52. package/lib/commonjs/platform/ios.js +54 -0
  53. package/lib/commonjs/platform/ios.js.map +1 -0
  54. package/lib/commonjs/platform/streams.js +273 -0
  55. package/lib/commonjs/platform/streams.js.map +1 -0
  56. package/lib/commonjs/platform/timers.js +71 -0
  57. package/lib/commonjs/platform/timers.js.map +1 -0
  58. package/lib/commonjs/platform/visibility.js +60 -0
  59. package/lib/commonjs/platform/visibility.js.map +1 -0
  60. package/lib/commonjs/preflight.js +77 -0
  61. package/lib/commonjs/preflight.js.map +1 -0
  62. package/lib/commonjs/provider.js +75 -0
  63. package/lib/commonjs/provider.js.map +1 -0
  64. package/lib/commonjs/specs/NativeVoltkitRtc.js +29 -0
  65. package/lib/commonjs/specs/NativeVoltkitRtc.js.map +1 -0
  66. package/lib/module/audio.js +207 -0
  67. package/lib/module/audio.js.map +1 -0
  68. package/lib/module/components.js +200 -0
  69. package/lib/module/components.js.map +1 -0
  70. package/lib/module/create-client.js +42 -0
  71. package/lib/module/create-client.js.map +1 -0
  72. package/lib/module/errors.js +87 -0
  73. package/lib/module/errors.js.map +1 -0
  74. package/lib/module/globals.js +53 -0
  75. package/lib/module/globals.js.map +1 -0
  76. package/lib/module/index.js +33 -0
  77. package/lib/module/index.js.map +1 -0
  78. package/lib/module/local-media.js +387 -0
  79. package/lib/module/local-media.js.map +1 -0
  80. package/lib/module/native-session.js +360 -0
  81. package/lib/module/native-session.js.map +1 -0
  82. package/lib/module/native.js +87 -0
  83. package/lib/module/native.js.map +1 -0
  84. package/lib/module/package.json +1 -0
  85. package/lib/module/permissions.js +160 -0
  86. package/lib/module/permissions.js.map +1 -0
  87. package/lib/module/platform/android.js +122 -0
  88. package/lib/module/platform/android.js.map +1 -0
  89. package/lib/module/platform/common.js +128 -0
  90. package/lib/module/platform/common.js.map +1 -0
  91. package/lib/module/platform/devices.js +142 -0
  92. package/lib/module/platform/devices.js.map +1 -0
  93. package/lib/module/platform/index.js +24 -0
  94. package/lib/module/platform/index.js.map +1 -0
  95. package/lib/module/platform/ios.js +49 -0
  96. package/lib/module/platform/ios.js.map +1 -0
  97. package/lib/module/platform/streams.js +268 -0
  98. package/lib/module/platform/streams.js.map +1 -0
  99. package/lib/module/platform/timers.js +67 -0
  100. package/lib/module/platform/timers.js.map +1 -0
  101. package/lib/module/platform/visibility.js +54 -0
  102. package/lib/module/platform/visibility.js.map +1 -0
  103. package/lib/module/preflight.js +72 -0
  104. package/lib/module/preflight.js.map +1 -0
  105. package/lib/module/provider.js +70 -0
  106. package/lib/module/provider.js.map +1 -0
  107. package/lib/module/specs/NativeVoltkitRtc.js +37 -0
  108. package/lib/module/specs/NativeVoltkitRtc.js.map +1 -0
  109. package/lib/typescript/commonjs/audio.d.ts +58 -0
  110. package/lib/typescript/commonjs/audio.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/components.d.ts +58 -0
  112. package/lib/typescript/commonjs/components.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/create-client.d.ts +35 -0
  114. package/lib/typescript/commonjs/create-client.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/errors.d.ts +34 -0
  116. package/lib/typescript/commonjs/errors.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/globals.d.ts +16 -0
  118. package/lib/typescript/commonjs/globals.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/index.d.ts +24 -0
  120. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/local-media.d.ts +86 -0
  122. package/lib/typescript/commonjs/local-media.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/native-session.d.ts +38 -0
  124. package/lib/typescript/commonjs/native-session.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/native.d.ts +18 -0
  126. package/lib/typescript/commonjs/native.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/package.json +1 -0
  128. package/lib/typescript/commonjs/permissions.d.ts +30 -0
  129. package/lib/typescript/commonjs/permissions.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/platform/android.d.ts +4 -0
  131. package/lib/typescript/commonjs/platform/android.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/platform/common.d.ts +101 -0
  133. package/lib/typescript/commonjs/platform/common.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/platform/devices.d.ts +42 -0
  135. package/lib/typescript/commonjs/platform/devices.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/platform/index.d.ts +6 -0
  137. package/lib/typescript/commonjs/platform/index.d.ts.map +1 -0
  138. package/lib/typescript/commonjs/platform/ios.d.ts +4 -0
  139. package/lib/typescript/commonjs/platform/ios.d.ts.map +1 -0
  140. package/lib/typescript/commonjs/platform/streams.d.ts +82 -0
  141. package/lib/typescript/commonjs/platform/streams.d.ts.map +1 -0
  142. package/lib/typescript/commonjs/platform/timers.d.ts +19 -0
  143. package/lib/typescript/commonjs/platform/timers.d.ts.map +1 -0
  144. package/lib/typescript/commonjs/platform/visibility.d.ts +11 -0
  145. package/lib/typescript/commonjs/platform/visibility.d.ts.map +1 -0
  146. package/lib/typescript/commonjs/preflight.d.ts +19 -0
  147. package/lib/typescript/commonjs/preflight.d.ts.map +1 -0
  148. package/lib/typescript/commonjs/provider.d.ts +35 -0
  149. package/lib/typescript/commonjs/provider.d.ts.map +1 -0
  150. package/lib/typescript/commonjs/specs/NativeVoltkitRtc.d.ts +157 -0
  151. package/lib/typescript/commonjs/specs/NativeVoltkitRtc.d.ts.map +1 -0
  152. package/lib/typescript/module/audio.d.ts +58 -0
  153. package/lib/typescript/module/audio.d.ts.map +1 -0
  154. package/lib/typescript/module/components.d.ts +58 -0
  155. package/lib/typescript/module/components.d.ts.map +1 -0
  156. package/lib/typescript/module/create-client.d.ts +35 -0
  157. package/lib/typescript/module/create-client.d.ts.map +1 -0
  158. package/lib/typescript/module/errors.d.ts +34 -0
  159. package/lib/typescript/module/errors.d.ts.map +1 -0
  160. package/lib/typescript/module/globals.d.ts +16 -0
  161. package/lib/typescript/module/globals.d.ts.map +1 -0
  162. package/lib/typescript/module/index.d.ts +24 -0
  163. package/lib/typescript/module/index.d.ts.map +1 -0
  164. package/lib/typescript/module/local-media.d.ts +86 -0
  165. package/lib/typescript/module/local-media.d.ts.map +1 -0
  166. package/lib/typescript/module/native-session.d.ts +38 -0
  167. package/lib/typescript/module/native-session.d.ts.map +1 -0
  168. package/lib/typescript/module/native.d.ts +18 -0
  169. package/lib/typescript/module/native.d.ts.map +1 -0
  170. package/lib/typescript/module/package.json +1 -0
  171. package/lib/typescript/module/permissions.d.ts +30 -0
  172. package/lib/typescript/module/permissions.d.ts.map +1 -0
  173. package/lib/typescript/module/platform/android.d.ts +4 -0
  174. package/lib/typescript/module/platform/android.d.ts.map +1 -0
  175. package/lib/typescript/module/platform/common.d.ts +101 -0
  176. package/lib/typescript/module/platform/common.d.ts.map +1 -0
  177. package/lib/typescript/module/platform/devices.d.ts +42 -0
  178. package/lib/typescript/module/platform/devices.d.ts.map +1 -0
  179. package/lib/typescript/module/platform/index.d.ts +6 -0
  180. package/lib/typescript/module/platform/index.d.ts.map +1 -0
  181. package/lib/typescript/module/platform/ios.d.ts +4 -0
  182. package/lib/typescript/module/platform/ios.d.ts.map +1 -0
  183. package/lib/typescript/module/platform/streams.d.ts +82 -0
  184. package/lib/typescript/module/platform/streams.d.ts.map +1 -0
  185. package/lib/typescript/module/platform/timers.d.ts +19 -0
  186. package/lib/typescript/module/platform/timers.d.ts.map +1 -0
  187. package/lib/typescript/module/platform/visibility.d.ts +11 -0
  188. package/lib/typescript/module/platform/visibility.d.ts.map +1 -0
  189. package/lib/typescript/module/preflight.d.ts +19 -0
  190. package/lib/typescript/module/preflight.d.ts.map +1 -0
  191. package/lib/typescript/module/provider.d.ts +35 -0
  192. package/lib/typescript/module/provider.d.ts.map +1 -0
  193. package/lib/typescript/module/specs/NativeVoltkitRtc.d.ts +157 -0
  194. package/lib/typescript/module/specs/NativeVoltkitRtc.d.ts.map +1 -0
  195. package/package.json +140 -4
  196. package/plugin/build/android.d.ts +36 -0
  197. package/plugin/build/android.js +265 -0
  198. package/plugin/build/index.d.ts +9 -0
  199. package/plugin/build/index.js +54 -0
  200. package/plugin/build/ios.d.ts +4 -0
  201. package/plugin/build/ios.js +43 -0
  202. package/plugin/build/options.d.ts +93 -0
  203. package/plugin/build/options.js +140 -0
  204. package/react-native.config.js +11 -0
  205. package/src/audio.ts +221 -0
  206. package/src/components.tsx +233 -0
  207. package/src/create-client.ts +53 -0
  208. package/src/errors.ts +81 -0
  209. package/src/globals.ts +54 -0
  210. package/src/index.ts +95 -0
  211. package/src/local-media.ts +420 -0
  212. package/src/native-session.tsx +384 -0
  213. package/src/native.ts +84 -0
  214. package/src/permissions.ts +173 -0
  215. package/src/platform/android.ts +128 -0
  216. package/src/platform/common.ts +157 -0
  217. package/src/platform/devices.ts +148 -0
  218. package/src/platform/index.ts +22 -0
  219. package/src/platform/ios.ts +48 -0
  220. package/src/platform/streams.ts +285 -0
  221. package/src/platform/timers.ts +72 -0
  222. package/src/platform/visibility.ts +59 -0
  223. package/src/preflight.ts +60 -0
  224. package/src/provider.tsx +88 -0
  225. package/src/specs/NativeVoltkitRtc.ts +180 -0
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The client's platform on Android (ClientPlatform, @voltkit-rtc/client 0.9.12): react-native-webrtc for capture and
5
+ * streams, this package's native module for everything a browser gets from the DOM -- timers that keep running in the
6
+ * background and with the screen off, visibility from the process lifecycle, the network coming back, audio routing,
7
+ * audio focus, and stopping react-native-webrtc's screen-share service. Without the native module (Expo Go, an app not
8
+ * rebuilt) it falls back to JavaScript timers and AppState, routes nothing, and refuses screen sharing.
9
+ */
10
+ import { PixelRatio } from 'react-native';
11
+ import { RpcError } from '@voltkit-rtc/client';
12
+ import { listen, nativeConstants, nativeModule } from "../native.js";
13
+ import { loadWebRTC } from "../globals.js";
14
+ import { describeError, logError, webrtcMissing } from "../errors.js";
15
+ import { captureUserMedia, describePlatform, deviceEnv, hardwareH264 } from "./common.js";
16
+ import { enumerateDevices, onDeviceChange, routeAudio, switchCameraInPlace } from "./devices.js";
17
+ import { streamBook } from "./streams.js";
18
+ import { jsTimers, nativeTimers } from "./timers.js";
19
+ import { appStateVisibility, nativeVisibility } from "./visibility.js";
20
+
21
+ /** The network came back (a native callback) or the app came back to the front: the client checks its socket. */
22
+ function onOnline(module, visibility, listener) {
23
+ const stops = [module ? listen(module.onNetworkAvailable, 'onNetworkAvailable', () => listener()) : () => undefined, visibility.subscribe(visible => {
24
+ if (visible) listener();
25
+ })];
26
+ return () => {
27
+ for (const stop of stops) stop();
28
+ };
29
+ }
30
+
31
+ /**
32
+ * The system took the microphone (a phone call took audio focus, or the audio device module could not record) and
33
+ * gave it back (focus regained). Cameras: react-native-webrtc ends the track instead, which the client handles.
34
+ */
35
+ function onInterruption(module, kind, listener) {
36
+ if (kind !== 'mic') return () => undefined;
37
+ const stops = [listen(module.onAudioFocusChanged, 'onAudioFocusChanged', ({
38
+ focus
39
+ }) => {
40
+ if (focus === 'loss' || focus === 'lossTransient') listener(true);else if (focus === 'gain') listener(false);
41
+ }), listen(module.onMicrophoneError, 'onMicrophoneError', () => listener(true))];
42
+ return () => {
43
+ for (const stop of stops) stop();
44
+ };
45
+ }
46
+
47
+ /**
48
+ * Share the screen through react-native-webrtc's MediaProjection flow (ClientPlatform.getDisplayMedia). It needs its
49
+ * foreground service, which the init provider turns on from the manifest's meta-data (the Expo plugin's
50
+ * android.screenShare): without it Android refuses the projection, so `screen-share-service-required`. A refused
51
+ * consent is `screen-share-denied`.
52
+ */
53
+ async function getDisplayMedia(module) {
54
+ const webrtc = loadWebRTC();
55
+ if (!webrtc) throw webrtcMissing();
56
+ if (!module || !nativeConstants()?.screenShareEnabled) {
57
+ throw new RpcError('screen-share-service-required', "screen sharing needs react-native-webrtc's screen-share service: turn on the Expo plugin's android.screenShare option (meta-data in.voltkit.rtc.SCREEN_SHARE=true) and rebuild the app");
58
+ }
59
+ let stream;
60
+ try {
61
+ stream = await webrtc.mediaDevices.getDisplayMedia({});
62
+ } catch (err) {
63
+ const text = describeError(err);
64
+ // The consent refused: react-native-webrtc starts its service only after the user allows the share.
65
+ if (/NotAllowedError/.test(text)) throw new RpcError('screen-share-denied', 'the screen share was not allowed');
66
+ if (/Another operation is pending/.test(text)) throw new RpcError('screen-share-active', 'a screen share is already starting');
67
+ // Allowed, but its MediaProjectionService did not start in time (react-native-webrtc gives up after 10 s) or the
68
+ // capture failed: the service may still be starting, with no share to stop it (finding 5). Stop it.
69
+ module.stopScreenShareService().catch(stopErr => logError('could not stop the screen-share service', stopErr));
70
+ throw new RpcError('screen-share-failed', `the screen share could not start: ${text}`);
71
+ }
72
+ const book = streamBook();
73
+ book.adopt(stream, 'capture');
74
+ book.markScreen(stream);
75
+ return stream;
76
+ }
77
+
78
+ /** The Android platform. One per process (platform/index.ts). */
79
+ export function androidPlatform() {
80
+ const module = nativeModule();
81
+ const book = streamBook();
82
+ const timers = module ? nativeTimers(module) : jsTimers;
83
+ const visibility = module ? nativeVisibility(module) : appStateVisibility();
84
+ if (module) {
85
+ // react-native-webrtc stops its MediaProjectionService only when the screen track is released; stopTrack releases
86
+ // it, and this makes sure (Phase 0 finding 5).
87
+ book.onScreenStopped = () => {
88
+ module.stopScreenShareService().catch(err => logError('could not stop the screen-share service', err));
89
+ };
90
+ }
91
+ const platform = {
92
+ name: 'react-native',
93
+ describe: describePlatform,
94
+ getUserMedia: constraints => captureUserMedia(constraints),
95
+ getDisplayMedia: () => getDisplayMedia(module),
96
+ enumerateDevices: kind => enumerateDevices(module, kind),
97
+ onDeviceChange: listener => onDeviceChange(module, listener),
98
+ switchCameraInPlace: (track, deviceId) => switchCameraInPlace(track, deviceId),
99
+ createStream: tracks => book.create(tracks),
100
+ releaseStream: stream => book.release(stream),
101
+ adoptAppStream: stream => book.adopt(stream, 'app'),
102
+ stopTrack: track => book.stop(track),
103
+ verifyReplaceTrack: true,
104
+ detachTracks: tracks => book.detach(tracks),
105
+ appVisible: () => visibility.visible(),
106
+ onAppVisibility: listener => visibility.subscribe(listener),
107
+ onOnline: listener => onOnline(module, visibility, listener),
108
+ pixelRatio: () => PixelRatio.get(),
109
+ deviceEnv,
110
+ encodingProbe: () => hardwareH264,
111
+ simulcastTemporalLayers: 3,
112
+ remoteAudioLevels: 'stats',
113
+ audioLevelIntervalMs: 500,
114
+ timers
115
+ };
116
+ if (module) {
117
+ platform.routeAudio = (kind, deviceId) => routeAudio(module, kind, deviceId);
118
+ platform.onInterruption = (kind, listener) => onInterruption(module, kind, listener);
119
+ }
120
+ return platform;
121
+ }
122
+ //# sourceMappingURL=android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PixelRatio","RpcError","listen","nativeConstants","nativeModule","loadWebRTC","describeError","logError","webrtcMissing","captureUserMedia","describePlatform","deviceEnv","hardwareH264","enumerateDevices","onDeviceChange","routeAudio","switchCameraInPlace","streamBook","jsTimers","nativeTimers","appStateVisibility","nativeVisibility","onOnline","module","visibility","listener","stops","onNetworkAvailable","undefined","subscribe","visible","stop","onInterruption","kind","onAudioFocusChanged","focus","onMicrophoneError","getDisplayMedia","webrtc","screenShareEnabled","stream","mediaDevices","err","text","test","stopScreenShareService","catch","stopErr","book","adopt","markScreen","androidPlatform","timers","onScreenStopped","platform","name","describe","getUserMedia","constraints","track","deviceId","createStream","tracks","create","releaseStream","release","adoptAppStream","stopTrack","verifyReplaceTrack","detachTracks","detach","appVisible","onAppVisibility","pixelRatio","get","encodingProbe","simulcastTemporalLayers","remoteAudioLevels","audioLevelIntervalMs"],"sourceRoot":"../../../src","sources":["platform/android.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,QAAQ,QAA6B,qBAAqB;AAEnE,SAASC,MAAM,EAAEC,eAAe,EAAEC,YAAY,QAAQ,cAAW;AACjE,SAASC,UAAU,QAAQ,eAAY;AACvC,SAASC,aAAa,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,cAAW;AAClE,SAASC,gBAAgB,EAAEC,gBAAgB,EAAEC,SAAS,EAAEC,YAAY,QAAiE,aAAU;AAC/I,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,UAAU,EAAEC,mBAAmB,QAAQ,cAAW;AAC7F,SAASC,UAAU,QAAyC,cAAW;AACvE,SAASC,QAAQ,EAAEC,YAAY,QAAQ,aAAU;AACjD,SAASC,kBAAkB,EAAEC,gBAAgB,QAAyB,iBAAc;;AAEpF;AACA,SAASC,QAAQA,CAACC,MAAmB,EAAEC,UAAsB,EAAEC,QAAoB,EAAc;EAC/F,MAAMC,KAAK,GAAG,CACZH,MAAM,GAAGrB,MAAM,CAACqB,MAAM,CAACI,kBAAkB,EAAE,oBAAoB,EAAE,MAAMF,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAMG,SAAS,EACpGJ,UAAU,CAACK,SAAS,CA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,SAAS;IACTgE,aAAa,EAAEA,CAAA,KAAM/D,YAAY;IACjCgE,uBAAuB,EAAE,CAAC;IAC1BC,iBAAiB,EAAE,OAAO;IAC1BC,oBAAoB,EAAE,GAAG;IACzB1B;EACF,CAAC;EACD,IAAI7B,MAAM,EAAE;IACV+B,QAAQ,CAACvC,UAAU,GAAG,CAACkB,IAAI,EAAE2B,QAAQ,KAAK7C,UAAU,CAACQ,MAAM,EAAEU,IAAI,EAAE2B,QAAQ,CAAC;IAC5EN,QAAQ,CAACtB,cAAc,GAAG,CAACC,IAAI,EAAER,QAAQ,KAAKO,cAAc,CAACT,MAAM,EAAEU,IAAI,EAAER,QAAQ,CAAC;EACtF;EACA,OAAO6B,QAAQ;AACjB","ignoreList":[]}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * What the Android platform and the iOS preview share: what getDiagnostics() says, capture through react-native-webrtc
5
+ * with the permissions checked first and its errors made registry errors, and the device's facts.
6
+ */
7
+ import { Platform } from 'react-native';
8
+ import { RpcError } from '@voltkit-rtc/client';
9
+ import { loadWebRTC, webrtcVersion } from "../globals.js";
10
+ import { SDK_VERSION } from "../native.js";
11
+ import { describeError, permissionRefused, webrtcMissing } from "../errors.js";
12
+ import { checkMediaPermissions } from "../permissions.js";
13
+ import { streamBook } from "./streams.js";
14
+
15
+ /**
16
+ * The DOM's media types as the client declares them. This package compiles without the DOM library (React Native has
17
+ * none), so they are taken from the client's own declarations rather than named.
18
+ */
19
+
20
+ /**
21
+ * `ClientPlatform.adoptAppStream` (optional in @voltkit-rtc/client 0.9.12; this platform always provides it): the
22
+ * client is taking tracks from `stream`, a stream the app gave it (`publish(stream)`, `publishScreen({ stream })`),
23
+ * and will stop and release those tracks but never the stream, which is the app's. This platform then takes each track
24
+ * out of that stream before releasing it, so the app can release its stream after unpublish() or close() without
25
+ * react-native-webrtc 155 killing the app (Phase 0 finding 1). useLocalMedia().publish() is safe either way (its
26
+ * capture is made and released here).
27
+ */
28
+
29
+ /**
30
+ * The settings a track reports: react-native-webrtc's `MediaTrackSettings` (the web's has these fields too). A camera
31
+ * says its `width`, `height`, `frameRate`, `facingMode` (`'user'` or `'environment'`) and `deviceId`.
32
+ */
33
+
34
+ /**
35
+ * A media track by shape: react-native-webrtc's `MediaStreamTrack`, which every track this package hands out is
36
+ * (`useLocalMedia().stream?.getVideoTracks()[0]`), and the web's `MediaStreamTrack` as `@voltkit-rtc/client` types a
37
+ * remote track's `track`, which fits the same shape, so either goes into `VideoTrack` and `AudioTrack` as it is. Typed by
38
+ * shape so an app compiles without the DOM library (`@react-native/typescript-config` leaves it out, and the only
39
+ * `MediaStream` it then knows is an empty stub). `remote` and `release` are react-native-webrtc's: a received track, and
40
+ * freeing the native track, which the SDK does for its own tracks.
41
+ */
42
+
43
+ /**
44
+ * A media stream by shape: react-native-webrtc's `MediaStream`, which `useLocalMedia().stream` and `screenStream`
45
+ * are. Typed by shape for the same reason as `MediaStreamTrackLike`. `toURL()` is what an `RTCView` plays (`VideoTrack`
46
+ * does this), and `release()` frees the native stream: never call it on a stream the SDK made (see `VideoTrack`).
47
+ */
48
+
49
+ /** The client's own stream (`client.local`), typed as react-native-webrtc's. */
50
+ export function localStream(client) {
51
+ return client.local ?? null;
52
+ }
53
+
54
+ /** getDiagnostics().userAgent: `ReactNative android 37; react-native-webrtc 155.0.1; @voltkit-rtc/react-native 0.1.1`. */
55
+ export function describePlatform() {
56
+ return `ReactNative ${Platform.OS} ${String(Platform.Version)}; react-native-webrtc ${webrtcVersion() ?? 'unknown'}; @voltkit-rtc/react-native ${SDK_VERSION}`;
57
+ }
58
+
59
+ /**
60
+ * What the client reads to pick its defaults: a phone or tablet, so two simulcast layers and the H.264 decision
61
+ * (there is no user agent in React Native, which gave phones a computer's three layers).
62
+ */
63
+ export function deviceEnv() {
64
+ const device = Platform.OS === 'ios' ? Platform.isPad ? 'iPad' : 'iPhone' : 'Android';
65
+ return {
66
+ userAgent: `ReactNative ${device} ${String(Platform.Version)}; Mobile`,
67
+ uaMobile: true,
68
+ maxTouchPoints: 5
69
+ };
70
+ }
71
+
72
+ /**
73
+ * Whether H.264 is encoded in hardware, asked only for a phone whose WebRTC can send H.264 at all. On Android
74
+ * react-native-webrtc's libwebrtc has no software H.264 encoder (the emulator, without a hardware one, offers none), so
75
+ * a device that offers it encodes it in hardware: 'auto' then sends H.264, as the Android SDK does.
76
+ */
77
+ export const hardwareH264 = async () => ({
78
+ supported: true,
79
+ smooth: true,
80
+ powerEfficient: true
81
+ });
82
+
83
+ /** The kinds a capture asks for, as permissions. */
84
+ export function kindsOf(constraints) {
85
+ const kinds = [];
86
+ if (constraints.video) kinds.push('camera');
87
+ if (constraints.audio) kinds.push('microphone');
88
+ return kinds;
89
+ }
90
+
91
+ /**
92
+ * Capture a camera and/or microphone through react-native-webrtc (ClientPlatform.getUserMedia). The permissions are
93
+ * checked first, without asking (a reconnect in the background must not open a dialog): one not granted rejects with
94
+ * `media-unavailable` `{ permission, status }` and nothing opens. react-native-webrtc drops a kind whose permission was
95
+ * refused without an error, so a stream missing a kind asked for is released and refused the same way. The stream is
96
+ * kept in the book, so it is released once its tracks are stopped.
97
+ */
98
+ export async function captureUserMedia(constraints) {
99
+ const webrtc = loadWebRTC();
100
+ if (!webrtc) throw webrtcMissing();
101
+ const kinds = kindsOf(constraints);
102
+ const statuses = await checkMediaPermissions(kinds);
103
+ for (const kind of kinds) {
104
+ const status = statuses[kind];
105
+ if (status !== 'granted') throw permissionRefused(kind, status === 'blocked' ? 'blocked' : 'denied');
106
+ }
107
+ let stream;
108
+ try {
109
+ stream = await webrtc.mediaDevices.getUserMedia(constraints);
110
+ } catch (err) {
111
+ const name = err?.name;
112
+ if (name === 'SecurityError' || name === 'NotAllowedError') throw permissionRefused(kinds[0] ?? 'camera', 'denied');
113
+ throw new RpcError('media-unavailable', `could not open the ${kinds.join(' and ')}: ${describeError(err)}`, {
114
+ reason: typeof name === 'string' ? name : 'capture-failed'
115
+ });
116
+ }
117
+ const book = streamBook();
118
+ book.adopt(stream, 'capture');
119
+ const missing = constraints.video && stream.getVideoTracks().length === 0 ? 'camera' : constraints.audio && stream.getAudioTracks().length === 0 ? 'microphone' : null;
120
+ if (missing) {
121
+ const tracks = stream.getTracks();
122
+ book.release(stream);
123
+ for (const track of tracks) book.stop(track);
124
+ throw permissionRefused(missing, 'denied');
125
+ }
126
+ return stream;
127
+ }
128
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","RpcError","loadWebRTC","webrtcVersion","SDK_VERSION","describeError","permissionRefused","webrtcMissing","checkMediaPermissions","streamBook","localStream","client","local","describePlatform","OS","String","Version","deviceEnv","device","isPad","userAgent","uaMobile","maxTouchPoints","hardwareH264","supported","smooth","powerEfficient","kindsOf","constraints","kinds","video","push","audio","captureUserMedia","webrtc","statuses","kind","status","stream","mediaDevices","getUserMedia","err","name","join","reason","book","adopt","missing","getVideoTracks","length","getAudioTracks","tracks","getTracks","release","track","stop"],"sourceRoot":"../../../src","sources":["platform/common.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,QAAQ,QAAqE,qBAAqB;AAC3G,SAASC,UAAU,EAAEC,aAAa,QAAQ,eAAY;AACtD,SAASC,WAAW,QAAQ,cAAW;AACvC,SAASC,aAAa,EAAEC,iBAAiB,EAAEC,aAAa,QAAkC,cAAW;AACrG,SAASC,qBAAqB,QAAQ,mBAAgB;AACtD,SAASC,UAAU,QAAyB,cAAW;;AAEvD;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;;AAaA;AACA,OAAO,SAASC,WAAWA,CAACC,MAAmC,EAA0B;EACvF,OAAQA,MAAM,CAACC,KAAK,IAA2C,IAAI;AACrE;;AAEA;AACA,OAAO,SAASC,gBAAgBA,CA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CAACQ,OAAO,CAACf,MAAM,CAAC;IACpB,KAAK,MAAMgB,KAAK,IAAIH,MAAM,EAAEN,IAAI,CAACU,IAAI,CAACD,KAAK,CAAC;IAC5C,MAAMhD,iBAAiB,CAACyC,OAAO,EAAE,QAAQ,CAAC;EAC5C;EACA,OAAOT,MAAM;AACf","ignoreList":[]}
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Cameras, microphones and audio outputs.
5
+ *
6
+ * Cameras come from react-native-webrtc (ids "0", "1", ... with a facing), named as the Android SDK names them ("Front
7
+ * camera", "Back camera 2"). On Android the audio devices come from this package's audio router (speaker, earpiece,
8
+ * wired and USB headsets, Bluetooth, each with its `type`), which also routes sound and picks the microphone natively;
9
+ * without the native module, and on iOS, from react-native-webrtc's list.
10
+ *
11
+ * A camera is switched on its own track (react-native-webrtc's applyConstraints with the deviceId): the same track and
12
+ * producer, so nothing can fail half-way. react-native-webrtc falls back to the facing mode, without an error, for an
13
+ * id it does not know, so the id is checked against the list first (`bad-params`) and the camera it ended up on is
14
+ * checked after (`camera-failed`); the old camera keeps capturing either way.
15
+ */
16
+ import { RpcError } from '@voltkit-rtc/client';
17
+ import { loadWebRTC } from "../globals.js";
18
+ import { listen, toMediaDevice } from "../native.js";
19
+ import { describeError, logError, nativeFailure } from "../errors.js";
20
+ /** react-native-webrtc's own list: cameras with a facing, one microphone on Android. */
21
+ async function webrtcDevices() {
22
+ const webrtc = loadWebRTC();
23
+ if (!webrtc) return [];
24
+ try {
25
+ const list = await webrtc.mediaDevices.enumerateDevices();
26
+ return Array.isArray(list) ? list : [];
27
+ } catch (err) {
28
+ logError('could not list the cameras', err);
29
+ return [];
30
+ }
31
+ }
32
+ const FACING_ORDER = {
33
+ front: 0,
34
+ back: 1,
35
+ external: 2
36
+ };
37
+
38
+ /** The cameras, front ones first, labelled as the Android SDK labels them. */
39
+ export async function listCameras() {
40
+ const cameras = (await webrtcDevices()).filter(d => d.kind === 'videoinput' && typeof d.deviceId === 'string');
41
+ let fronts = 0;
42
+ let backs = 0;
43
+ const named = cameras.map(d => {
44
+ const facing = d.facing === 'front' || d.facing === 'user' ? 'front' : d.facing === 'environment' || d.facing === 'back' ? 'back' : 'external';
45
+ let label;
46
+ if (facing === 'front') label = (fronts += 1) === 1 ? 'Front camera' : `Front camera ${fronts}`;else if (facing === 'back') label = (backs += 1) === 1 ? 'Back camera' : `Back camera ${backs}`;else label = 'External camera';
47
+ return {
48
+ deviceId: d.deviceId,
49
+ groupId: typeof d.groupId === 'string' ? d.groupId : '',
50
+ kind: 'videoinput',
51
+ label,
52
+ facing
53
+ };
54
+ });
55
+ return named.sort((a, b) => FACING_ORDER[a.facing ?? 'external'] - FACING_ORDER[b.facing ?? 'external']);
56
+ }
57
+
58
+ /** Audio devices from react-native-webrtc (iOS, or Android without the native module). */
59
+ async function webrtcAudio() {
60
+ return (await webrtcDevices()).filter(d => (d.kind === 'audioinput' || d.kind === 'audiooutput') && typeof d.deviceId === 'string').map(d => ({
61
+ deviceId: d.deviceId,
62
+ groupId: typeof d.groupId === 'string' ? d.groupId : '',
63
+ kind: d.kind,
64
+ label: typeof d.label === 'string' ? d.label : '',
65
+ ...(d.kind === 'audioinput' ? {
66
+ type: 'builtinMic'
67
+ } : {})
68
+ }));
69
+ }
70
+
71
+ /** Audio devices from the audio router (Android). */
72
+ async function nativeAudio(module) {
73
+ try {
74
+ return (await module.listAudioDevices()).map(toMediaDevice);
75
+ } catch (err) {
76
+ logError('could not list the audio devices', err);
77
+ return [];
78
+ }
79
+ }
80
+
81
+ /** Every device, or those of one kind (ClientPlatform.enumerateDevices). */
82
+ export async function enumerateDevices(module, kind) {
83
+ const wantCameras = kind === undefined || kind === 'videoinput';
84
+ const wantAudio = kind === undefined || kind !== 'videoinput';
85
+ const [cameras, audio] = await Promise.all([wantCameras ? listCameras() : Promise.resolve([]), wantAudio ? module ? nativeAudio(module) : webrtcAudio() : Promise.resolve([])]);
86
+ const all = [...audio, ...cameras];
87
+ return kind === undefined ? all : all.filter(d => d.kind === kind);
88
+ }
89
+
90
+ /** Hear audio devices come and go (Android's router); cameras cannot be watched. */
91
+ export function onDeviceChange(module, listener) {
92
+ if (!module) return null;
93
+ return listen(module.onAudioDevicesChanged, 'onAudioDevicesChanged', () => listener());
94
+ }
95
+
96
+ /**
97
+ * Route sound to an output, or record from a microphone, natively (ClientPlatform.routeAudio). Outputs: true when
98
+ * routed, false when it cannot be chosen (the client then rejects with `bad-params`). Microphones: true when the audio
99
+ * device module records from it now; `bad-params` for one the router does not list; false (the client captures it)
100
+ * where the module cannot choose.
101
+ */
102
+ export async function routeAudio(module, kind, deviceId) {
103
+ if (kind === 'audioinput') {
104
+ const inputs = (await nativeAudio(module)).filter(d => d.kind === 'audioinput');
105
+ if (!inputs.some(d => d.deviceId === deviceId)) {
106
+ throw new RpcError('bad-params', `switchDevice: there is no microphone with the id ${deviceId}`);
107
+ }
108
+ }
109
+ try {
110
+ return await (kind === 'audiooutput' ? module.selectAudioOutput(deviceId) : module.selectAudioInput(deviceId));
111
+ } catch (err) {
112
+ // The router's own failure (a TurboModule rejection is a plain Error): a registry error for the app.
113
+ throw nativeFailure(err);
114
+ }
115
+ }
116
+
117
+ /** react-native-webrtc's camera track, as far as switching needs it. */
118
+
119
+ /** Turn the camera behind `track` to `deviceId`, on the same track (ClientPlatform.switchCameraInPlace). */
120
+ export async function switchCameraInPlace(track, deviceId) {
121
+ if (track.kind !== 'video') throw new RpcError('bad-params', 'switchDevice: that track is not a camera');
122
+ const cameras = await listCameras();
123
+ const target = cameras.find(c => c.deviceId === deviceId);
124
+ if (!target) throw new RpcError('bad-params', `switchDevice: there is no camera with the id ${deviceId}`);
125
+ if (track.getSettings().deviceId === deviceId) return;
126
+ const constraints = {
127
+ ...track.getConstraints(),
128
+ deviceId
129
+ };
130
+ // react-native-webrtc keeps the facing it has when none is given; the target's matches the id it is given.
131
+ if (target.facing === 'front' || target.facing === 'back') constraints.facingMode = target.facing === 'front' ? 'user' : 'environment';
132
+ try {
133
+ await track.applyConstraints(constraints);
134
+ } catch (err) {
135
+ throw new RpcError('camera-failed', `could not switch to camera ${deviceId}: ${describeError(err)}`);
136
+ }
137
+ const now = track.getSettings().deviceId;
138
+ if (now !== deviceId) {
139
+ throw new RpcError('camera-failed', `the camera did not switch to ${deviceId}${typeof now === 'string' ? ` (it is still ${now})` : ''}`);
140
+ }
141
+ }
142
+ //# sourceMappingURL=devices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RpcError","loadWebRTC","listen","toMediaDevice","describeError","logError","nativeFailure","webrtcDevices","webrtc","list","mediaDevices","enumerateDevices","Array","isArray","err","FACING_ORDER","front","back","external","listCameras","cameras","filter","d","kind","deviceId","fronts","backs","named","map","facing","label","groupId","sort","a","b","webrtcAudio","type","nativeAudio","module","listAudioDevices","wantCameras","undefined","wantAudio","audio","Promise","all","resolve","onDeviceChange","listener","onAudioDevicesChanged","routeAudio","inputs","some","selectAudioOutput","selectAudioInput","switchCameraInPlace","track","target","find","c","getSettings","constraints","getConstraints","facingMode","applyConstraints","now"],"sourceRoot":"../../../src","sources":["platform/devices.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,QAA8D,qBAAqB;AAEpG,SAASC,UAAU,QAAQ,eAAY;AACvC,SAASC,MAAM,EAAEC,aAAa,QAAQ,cAAW;AACjD,SAASC,aAAa,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,cAAW;AAUlE;AACA,eAAeC,aAAaA,CAAA,EAA4B;EACtD,MAAMC,MAAM,GAAGP,UAAU,CAAC,CAAC;EAC3B,IAAI,CAACO,MAAM,EAAE,OAAO,EAAE;EACtB,IAAI;IACF,MAAMC,IAAI,GAAI,MAAMD,MAAM,CAACE,YAAY,CAACC,gBAAgB,CAAC,CAAa;IACtE,OAAOC,KAAK,CAACC,OAAO,CAACJ,IAAI,CAAC,GAAIA,IAAI,GAAsB,EAAE;EAC5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AM2B,KAAK,CAACQ,gBAAgB,CAACH,WAAW,CAAC;EAC3C,CAAC,CAAC,OAAO/C,GAAG,EAAE;IACZ,MAAM,IAAId,QAAQ,CAAC,eAAe,EAAE,8BAA8BwB,QAAQ,KAAKpB,aAAa,CAACU,GAAG,CAAC,EAAE,CAAC;EACtG;EACA,MAAMmD,GAAG,GAAGT,KAAK,CAACI,WAAW,CAAC,CAAC,CAACpC,QAAQ;EACxC,IAAIyC,GAAG,KAAKzC,QAAQ,EAAE;IACpB,MAAM,IAAIxB,QAAQ,CAAC,eAAe,EAAE,gCAAgCwB,QAAQ,GAAG,OAAOyC,GAAG,KAAK,QAAQ,GAAG,iBAAiBA,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC;EAC1I;AACF","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The React Native platform for @voltkit-rtc/client (ClientOptions.platform): one per process, for every client, view
5
+ * and hook, made on first use for the platform the app runs on. createClient() and the provider pass it; an app that
6
+ * makes a StreamClient itself passes `reactNativePlatform()` (or uses createClient).
7
+ */
8
+ import { Platform } from 'react-native';
9
+ import { androidPlatform } from "./android.js";
10
+ import { iosPlatform } from "./ios.js";
11
+ let shared = null;
12
+
13
+ /** The React Native platform for this app (Android, or the iOS preview). The same object every time. */
14
+ export function reactNativePlatform() {
15
+ if (shared?.os !== Platform.OS) {
16
+ shared = {
17
+ os: Platform.OS,
18
+ platform: Platform.OS === 'ios' ? iosPlatform() : androidPlatform()
19
+ };
20
+ }
21
+ return shared.platform;
22
+ }
23
+ export { streamBook } from "./streams.js";
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","androidPlatform","iosPlatform","shared","reactNativePlatform","os","OS","platform","streamBook"],"sourceRoot":"../../../src","sources":["platform/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,SAASC,eAAe,QAAQ,cAAW;AAC3C,SAASC,WAAW,QAAQ,UAAO;AAEnC,IAAIC,MAAuD,GAAG,IAAI;;AAElE;AACA,OAAO,SAASC,mBAAmBA,CAAA,EAAmB;EACpD,IAAID,MAAM,EAAEE,EAAE,KAAKL,QAAQ,CAACM,EAAE,EAAE;IAC9BH,MAAM,GAAG;MAAEE,EAAE,EAAEL,QAAQ,CAACM,EAAE;MAAEC,QAAQ,EAAEP,QAAQ,CAACM,EAAE,KAAK,KAAK,GAAGJ,WAAW,CAAC,CAAC,GAAGD,eAAe,CAAC;IAAE,CAAC;EACnG;EACA,OAAOE,MAAM,CAACI,QAAQ;AACxB;AAEA,SAASC,UAAU,QAAQ,cAAW","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The client's platform in the iOS preview (JavaScript only in 0.1.0: VoltKit has not compiled or run it). Capture,
5
+ * streams and views are react-native-webrtc's as on Android; visibility comes from AppState with `inactive` counted
6
+ * as visible; timers are JavaScript's. There is no audio routing (`media-unavailable` with `{ platform: 'ios' }`),
7
+ * no call service and no screen sharing (`screen-share-unsupported`).
8
+ */
9
+ import { PixelRatio } from 'react-native';
10
+ import { iosUnsupported } from "../errors.js";
11
+ import { captureUserMedia, describePlatform, deviceEnv } from "./common.js";
12
+ import { enumerateDevices, switchCameraInPlace } from "./devices.js";
13
+ import { streamBook } from "./streams.js";
14
+ import { jsTimers } from "./timers.js";
15
+ import { appStateVisibility } from "./visibility.js";
16
+ export function iosPlatform() {
17
+ const book = streamBook();
18
+ const visibility = appStateVisibility();
19
+ return {
20
+ name: 'react-native',
21
+ describe: describePlatform,
22
+ getUserMedia: constraints => captureUserMedia(constraints),
23
+ enumerateDevices: kind => enumerateDevices(null, kind),
24
+ routeAudio: async kind => {
25
+ if (kind === 'audiooutput') throw iosUnsupported('Choosing the audio output');
26
+ // A microphone is captured with its deviceId, as in a browser.
27
+ return false;
28
+ },
29
+ switchCameraInPlace: (track, deviceId) => switchCameraInPlace(track, deviceId),
30
+ createStream: tracks => book.create(tracks),
31
+ releaseStream: stream => book.release(stream),
32
+ adoptAppStream: stream => book.adopt(stream, 'app'),
33
+ stopTrack: track => book.stop(track),
34
+ verifyReplaceTrack: true,
35
+ detachTracks: tracks => book.detach(tracks),
36
+ appVisible: () => visibility.visible(),
37
+ onAppVisibility: listener => visibility.subscribe(listener),
38
+ onOnline: listener => visibility.subscribe(visible => {
39
+ if (visible) listener();
40
+ }),
41
+ pixelRatio: () => PixelRatio.get(),
42
+ deviceEnv,
43
+ simulcastTemporalLayers: 3,
44
+ remoteAudioLevels: 'stats',
45
+ audioLevelIntervalMs: 500,
46
+ timers: jsTimers
47
+ };
48
+ }
49
+ //# sourceMappingURL=ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PixelRatio","iosUnsupported","captureUserMedia","describePlatform","deviceEnv","enumerateDevices","switchCameraInPlace","streamBook","jsTimers","appStateVisibility","iosPlatform","book","visibility","name","describe","getUserMedia","constraints","kind","routeAudio","track","deviceId","createStream","tracks","create","releaseStream","stream","release","adoptAppStream","adopt","stopTrack","stop","verifyReplaceTrack","detachTracks","detach","appVisible","visible","onAppVisibility","listener","subscribe","onOnline","pixelRatio","get","simulcastTemporalLayers","remoteAudioLevels","audioLevelIntervalMs","timers"],"sourceRoot":"../../../src","sources":["platform/ios.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,cAAc;AAEzC,SAASC,cAAc,QAAQ,cAAW;AAC1C,SAASC,gBAAgB,EAAEC,gBAAgB,EAAEC,SAAS,QAAiE,aAAU;AACjI,SAASC,gBAAgB,EAAEC,mBAAmB,QAAQ,cAAW;AACjE,SAASC,UAAU,QAAyC,cAAW;AACvE,SAASC,QAAQ,QAAQ,aAAU;AACnC,SAASC,kBAAkB,QAAQ,iBAAc;AAEjD,OAAO,SAASC,WAAWA,CAAA,EAAmC;EAC5D,MAAMC,IAAI,GAAGJ,UAAU,CAAC,CAAC;EACzB,M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