@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,34 @@
1
+ /**
2
+ * The errors this package raises. Every one is an RpcError with a code from the VoltKit error registry
3
+ * (@voltkit-rtc/client ERROR_CODES, checked code for code against every SDK by scripts/test/sdk-contract-sdks.mjs), so
4
+ * an app switches on `error.code` exactly as it does in a browser or the Android SDK. What is missing goes in `data`:
5
+ *
6
+ * - `media-unavailable` `{ reason: 'webrtc-missing' }`: react-native-webrtc's native module is not in the app (Expo Go,
7
+ * or an app not rebuilt after installing it). The message says it needs a development build.
8
+ * - `media-unavailable` `{ reason: 'native-missing', feature }`: this package's own native module is not in the app.
9
+ * - `media-unavailable` `{ platform: 'ios', feature }`: not in the iOS preview (audio routing: setSpeakerphoneOn,
10
+ * selectAudioOutput, switchDevice('audiooutput')). The call service and screen sharing do not raise it there: the
11
+ * service is simply not declared (useCallService), and the client answers `screen-share-unsupported`.
12
+ * - `media-unavailable` `{ permission: 'camera' | 'microphone', status: 'denied' | 'blocked' }`: a refused permission,
13
+ * the field names of the Android SDK.
14
+ * - `media-unavailable` `{ feature: 'callService' }`: the call service could not start or keep running.
15
+ */
16
+ import { RpcError } from '@voltkit-rtc/client';
17
+ export type MediaPermissionKind = 'camera' | 'microphone';
18
+ /** react-native-webrtc's native module is missing: Expo Go, or the app was not rebuilt. */
19
+ export declare function webrtcMissing(): RpcError;
20
+ /** This package's own native module is missing: the app was not rebuilt after installing it. */
21
+ export declare function nativeMissing(feature: string): RpcError;
22
+ /** Not in the iOS preview of 0.1.0. */
23
+ export declare function iosUnsupported(feature: string): RpcError;
24
+ /** A camera or microphone permission the user refused: `blocked` when Android will not ask again. */
25
+ export declare function permissionRefused(permission: MediaPermissionKind, status: 'denied' | 'blocked'): RpcError;
26
+ /** The call service could not start, or Android stopped it. */
27
+ export declare function callServiceFailed(message: string): RpcError;
28
+ /** A failure a native module or react-native-webrtc reported, as an RpcError with a registry code. */
29
+ export declare function nativeFailure(error: unknown, code?: 'media-unavailable' | 'camera-failed' | 'screen-share-failed', data?: Record<string, unknown>): RpcError;
30
+ /** A readable message from anything thrown: an Error, react-native-webrtc's MediaStreamError (not an Error), a string. */
31
+ export declare function describeError(error: unknown): string;
32
+ /** Report a failure from code no caller awaits: the error listener's own errors never escape into the app. */
33
+ export declare function logError(context: string, error: unknown): void;
34
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE1D,2FAA2F;AAC3F,wBAAgB,aAAa,IAAI,QAAQ,CAMxC;AAED,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAMvD;AAED,uCAAuC;AACvC,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAExD;AAED,qGAAqG;AACrG,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAMzG;AAED,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAE3D;AAED,sGAAsG;AACtG,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,GAAE,mBAAmB,GAAG,eAAe,GAAG,qBAA2C,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAGjL;AAED,0HAA0H;AAC1H,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAWpD;AAED,8GAA8G;AAC9G,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAG9D"}
@@ -0,0 +1,16 @@
1
+ import type * as WebRTC from 'react-native-webrtc';
2
+ export type WebRTCModule = typeof WebRTC;
3
+ /** Whether react-native-webrtc's native module is in this app. */
4
+ export declare function webrtcAvailable(): boolean;
5
+ /** react-native-webrtc, or null when its native module is not in the app (Expo Go, an app not rebuilt). */
6
+ export declare function loadWebRTC(): WebRTCModule | null;
7
+ /**
8
+ * Install react-native-webrtc's WebRTC classes as globals (RTCPeerConnection, MediaStream, ...), which mediasoup-client
9
+ * needs. Runs when the package is imported; calling it again does nothing. Returns false, without throwing, where
10
+ * react-native-webrtc's native module is missing: the provider then reports `media-unavailable` with
11
+ * `{ reason: 'webrtc-missing' }`.
12
+ */
13
+ export declare function registerVoltkitGlobals(): boolean;
14
+ /** The version of react-native-webrtc in the app, for getDiagnostics(); null when it cannot be read. */
15
+ export declare function webrtcVersion(): string | null;
16
+ //# sourceMappingURL=globals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../src/globals.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,YAAY,GAAG,OAAO,MAAM,CAAC;AAKzC,kEAAkE;AAClE,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,2GAA2G;AAC3G,wBAAgB,UAAU,IAAI,YAAY,GAAG,IAAI,CAMhD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAOhD;AAED,wGAAwG;AACxG,wBAAgB,aAAa,IAAI,MAAM,GAAG,IAAI,CAQ7C"}
@@ -0,0 +1,24 @@
1
+ export { registerVoltkitGlobals } from './globals.js';
2
+ export { createClient, reactNativeClientOptions } from './create-client.js';
3
+ export type { BackgroundOptions, CreateClientOptions } from './create-client.js';
4
+ export { preflight } from './preflight.js';
5
+ export type { ReactNativePreflightOptions } from './preflight.js';
6
+ export { reactNativePlatform } from './platform/index.js';
7
+ export type { MediaStreamLike, MediaStreamTrackLike, MediaTrackSettingsLike } from './platform/common.js';
8
+ export { VoltkitProvider } from './provider.js';
9
+ export type { VoltkitProviderProps } from './provider.js';
10
+ export { useCallService } from './native-session.js';
11
+ export type { AudioSessionOptions, CallServiceState, CallServiceText } from './native-session.js';
12
+ export { useLocalMedia } from './local-media.js';
13
+ export type { LocalMedia, LocalPublishOptions } from './local-media.js';
14
+ export { VideoTrack, AudioTrack } from './components.js';
15
+ export type { VideoTrackProps, AudioTrackProps } from './components.js';
16
+ export { useAudioOutput, setSpeakerphoneOn, selectAudioOutput } from './audio.js';
17
+ export type { AudioOutput } from './audio.js';
18
+ export { requestMediaPermissions, checkMediaPermissions, usePermissions } from './permissions.js';
19
+ export type { PermissionKind, PermissionStatus, PermissionStatuses, Permissions } from './permissions.js';
20
+ export { SDK_VERSION } from './native.js';
21
+ export { useVoltkitClient, useRoom, useConnectionState, useParticipants, useRemoteTracks, useNetworkQuality, useWalletLow, useVoltkitEvent, useActiveSpeakers, useAudioLevels, useCpuConstrained, useDevices, useIsSpeaking, useMediaWarnings, usePublishFallback, useStreamFallback, } from '@voltkit-rtc/react';
22
+ export type { RoomState, RemoteTrackFilter, WalletLowState } from '@voltkit-rtc/react';
23
+ export type { AudioDeviceType, AudioQuality, CameraFacing, ChatMessage, ClientEvents, ClientOptions, ClientPlatform, ClosedReason, CodecPreference, ConnectionState, DeviceHandlerName, DeviceKind, ErrorCode, JoinResult, LayerCount, LocalMediaState, MediaDevice, MediaPermissions, NetworkQuality, NetworkQualityLevel, ParticipantInfo, PreflightReport, PublishOptions, RemoteTrack, Role, ScreenMode, ScreenPublishOptions, SendMessageOptions, StreamClient, TokenExpiringNotice, TrackSource, UsageLimitNotice, VideoQuality, WalletLowNotice, } from '@volt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AAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,kBAAe,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,aAAU,CAAC;AAGvC,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGvF,YAAY,EACV,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,cAAc,EACd,WAAW,EACX,IAAI,EACJ,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,eAAe,GAChB,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { type AudioQuality, type MediaPermissions, type PublishOptions, type ScreenPublishOptions, type StreamClient, type VideoQuality } from '@voltkit-rtc/client';
2
+ import { type MediaStreamLike, type UserMediaConstraints } from './platform/common.js';
3
+ /** A camera's or microphone's constraints, as the client declares them (this package compiles without the DOM library). */
4
+ type TrackConstraints = Exclude<NonNullable<UserMediaConstraints['audio']>, boolean>;
5
+ export interface LocalPublishOptions extends PublishOptions {
6
+ /** The microphone: true (the default) for VoltKit's settings, false for none, or your own constraints, used as given. */
7
+ audio?: boolean | TrackConstraints;
8
+ /** The camera: true (the default) for the quality's frame and frame rate, false for none, or your own constraints. */
9
+ video?: boolean | TrackConstraints;
10
+ /** Which camera: `'user'` (front, the default) or `'environment'` (back). Only with `video: true`. */
11
+ facingMode?: 'user' | 'environment';
12
+ }
13
+ export interface LocalMedia {
14
+ /**
15
+ * Your camera and microphone as published (`client.local`); null when not publishing them. react-native-webrtc's
16
+ * stream, typed by shape (`MediaStreamLike`): `stream.getVideoTracks()[0]` is the camera for a `VideoTrack`.
17
+ */
18
+ stream: MediaStreamLike | null;
19
+ /** True while anything is published: camera, microphone, screen or music. */
20
+ publishing: boolean;
21
+ micEnabled: boolean;
22
+ camEnabled: boolean;
23
+ /** What the microphone is sent at, after the project's limit. */
24
+ audioQuality: AudioQuality;
25
+ /** What the camera is sent at, after the project's limit. */
26
+ videoQuality: VideoQuality;
27
+ videoFrameRate: 30 | 60;
28
+ screenSharing: boolean;
29
+ /** The screen being shared, for a preview; null when not sharing. */
30
+ screenStream: MediaStreamLike | null;
31
+ /** What this project lets this client publish: offer only these. */
32
+ permissions: MediaPermissions;
33
+ /** The published camera faces you (`'user'`) or away (`'environment'`); null without a camera. */
34
+ facingMode: 'user' | 'environment' | null;
35
+ /**
36
+ * Open the camera and microphone and publish them, asking for their permissions first. Only hosts and cohosts may.
37
+ * A refused permission rejects with `media-unavailable` `{ permission: 'camera' | 'microphone', status: 'denied' |
38
+ * 'blocked' }` before any device opens.
39
+ */
40
+ publish(options?: LocalPublishOptions): Promise<void>;
41
+ /** Stop publishing everything, screen and music included, and release the devices. */
42
+ unpublish(): Promise<void>;
43
+ setMicEnabled(on: boolean): Promise<void>;
44
+ setCamEnabled(on: boolean): Promise<void>;
45
+ /** Resolves to the quality in use; rejects with `audio-quality-not-allowed` for HD where the project allows standard only. */
46
+ setAudioQuality(quality: AudioQuality): Promise<AudioQuality>;
47
+ /** Raises the camera's capture first when it is smaller than `quality`. Resolves to the quality used. */
48
+ setVideoQuality(quality: VideoQuality): Promise<VideoQuality>;
49
+ /** Resolves to the frame rate used: 30 where the project or the camera cannot do 60. */
50
+ setVideoFrameRate(frameRate: 30 | 60): Promise<30 | 60>;
51
+ /**
52
+ * Front to back or back to front, on the same track: viewers see no gap and the producer stays the same. Resolves
53
+ * true when the front camera is in use now (the contract's switchCamera). Rejects with `media-unavailable` when no
54
+ * camera is published. A device with one camera keeps it.
55
+ */
56
+ switchCamera(): Promise<boolean>;
57
+ /**
58
+ * Share the screen beside the camera (Android: react-native-webrtc's MediaProjection consent; the Expo plugin's
59
+ * android.screenShare must be on). `screen-share-denied` when the user cancels, `screen-share-service-required`
60
+ * without the plugin option, `screen-share-unsupported` on iOS.
61
+ */
62
+ startScreenShare(options?: ScreenPublishOptions): Promise<MediaStreamLike>;
63
+ stopScreenShare(): Promise<void>;
64
+ }
65
+ /**
66
+ * Per client: the screen being shared (only events tell it) and a signal for what changes without an event (publish,
67
+ * a camera switch). Recorded while held: the provider holds its client's for as long as it has the client.
68
+ */
69
+ declare class LocalSession {
70
+ private readonly client;
71
+ screen: MediaStreamLike | null;
72
+ private readonly listeners;
73
+ private holders;
74
+ private stopListening;
75
+ constructor(client: StreamClient);
76
+ hold(): () => void;
77
+ subscribe(listener: () => void): () => void;
78
+ changed(): void;
79
+ private listen;
80
+ private endScreen;
81
+ }
82
+ export declare function localSessionOf(client: StreamClient): LocalSession;
83
+ /** Your camera, microphone and screen: what is published, and the calls that change it. */
84
+ export declare function useLocalMedia(): LocalMedia;
85
+ export {};
86
+ //# sourceMappingURL=local-media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-media.d.ts","sourceRoot":"","sources":["../../../src/local-media.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EAAkC,KAAK,eAAe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,CAAC;IAC1C,8HAA8H;IAC9H,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9D,yGAAyG;IACzG,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9D,wFAAwF;IACxF,iBAAiB,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACxD;;;;OAIG;IACH,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC3E,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAID;;;GAGG;AACH,cAAM,YAAY;IAMJ,OAAO,CAAC,QAAQ,CAAC,MAAM;IALnC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAQ;IACtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IACnD,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,aAAa,CAA6B;gBAErB,MAAM,EAAE,YAAY;IAEjD,IAAI,IAAI,MAAM,IAAI;IAalB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAO3C,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,MAAM;IAkBd,OAAO,CAAC,SAAS;CAKlB;AAID,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAOjE;AA0FD,2FAA2F;AAC3F,wBAAgB,aAAa,IAAI,UAAU,CAM1C"}
@@ -0,0 +1,38 @@
1
+ /** The call service's notification. */
2
+ export interface CallServiceText {
3
+ /** Default "Call in progress". */
4
+ title?: string;
5
+ /** Default "Tap to return to the call". */
6
+ text?: string;
7
+ /** The Leave action's label. Default "Leave". */
8
+ leaveLabel?: string;
9
+ }
10
+ /** How the provider manages the call audio. */
11
+ export interface AudioSessionOptions {
12
+ /** The loudspeaker (true, the default) or the earpiece when no headset is connected, unless setSpeakerphoneOn chose. */
13
+ speakerphone?: boolean;
14
+ /** Hold the call audio (mode, focus, routing) while the call is connected. Default true. */
15
+ manage?: boolean;
16
+ }
17
+ export interface CallServiceState {
18
+ /** The app's manifest declares the call service (VoltkitCallService). */
19
+ declared: boolean;
20
+ /** It runs now. */
21
+ running: boolean;
22
+ /** The foreground service types it runs with: `microphone`, `mediaPlayback`, `camera`, `mediaProjection`. */
23
+ types: string[];
24
+ }
25
+ /** The call service: whether the app declares it, whether it runs and with which types. */
26
+ export declare function useCallService(): CallServiceState;
27
+ export interface NativeSessionProps {
28
+ audio: AudioSessionOptions | false | undefined;
29
+ callService: boolean | CallServiceText | undefined;
30
+ /** The provider's background.pauseCamera: for a client whose own options cannot be read (see pausesCameraInBackground). */
31
+ pauseCamera: boolean;
32
+ onError: {
33
+ readonly current: ((error: Error) => void) | undefined;
34
+ };
35
+ }
36
+ /** Rendered by the provider inside @voltkit-rtc/react's provider: keeps the call audio and the call service for its client. */
37
+ export declare function NativeSession({ audio, callService, pauseCamera, onError }: NativeSessionProps): null;
38
+ //# sourceMappingURL=native-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-session.d.ts","sourceRoot":"","sources":["../../../src/native-session.tsx"],"names":[],"mappings":"AAyBA,uCAAuC;AACvC,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,+CAA+C;AAC/C,MAAM,WAAW,mBAAmB;IAClC,wHAAwH;IACxH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,4FAA4F;IAC5F,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAgBD,MAAM,WAAW,gBAAgB;IAC/B,yEAAyE;IACzE,QAAQ,EAAE,OAAO,CAAC;IAClB,mBAAmB;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,6GAA6G;IAC7G,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AA2ND,2FAA2F;AAC3F,wBAAgB,cAAc,IAAI,gBAAgB,CAEjD;AAID,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,mBAAmB,GAAG,KAAK,GAAG,SAAS,CAAC;IAC/C,WAAW,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAAC;IACnD,2HAA2H;IAC3H,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS,CAAA;KAAE,CAAC;CACrE;AAED,+HAA+H;AAC/H,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,kBAAkB,GAAG,IAAI,CAkDpG"}
@@ -0,0 +1,18 @@
1
+ import type { EventSubscription } from 'react-native';
2
+ import { type AudioDevice, type Constants, type Spec } from './specs/NativeVoltkitRtc.js';
3
+ import type { MediaDevice } from '@voltkit-rtc/client';
4
+ /** The version of this package: what getDiagnostics() reports, and what the native side was built from. */
5
+ export declare const SDK_VERSION = "0.1.1";
6
+ /** The native module, or null where there is none (iOS, Expo Go, an app not rebuilt). */
7
+ export declare function nativeModule(): Spec | null;
8
+ /** The module's constants, read once: the audio mode, screen sharing, the call service as the manifest declares them. */
9
+ export declare function nativeConstants(): Constants | null;
10
+ /** The native module for `feature`, or the error that says why there is none. */
11
+ export declare function requireNative(feature: string): Spec;
12
+ /** Subscribe to one of the module's events; a listener that throws is logged and the others still run. */
13
+ export declare function listen<T>(emitter: ((handler: (value: T) => void) => EventSubscription) | undefined, name: string, listener: (value: T) => void): () => void;
14
+ /** A native audio device as the client's MediaDevice. */
15
+ export declare function toMediaDevice(device: AudioDevice): MediaDevice;
16
+ /** For tests: forget the cached constants. */
17
+ export declare function resetNativeForTests(): void;
18
+ //# sourceMappingURL=native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/native.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAyB,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,6BAA0B,CAAC;AAEzG,OAAO,KAAK,EAA+B,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEpF,2GAA2G;AAC3G,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,yFAAyF;AACzF,wBAAgB,YAAY,IAAI,IAAI,GAAG,IAAI,CAG1C;AAKD,yHAAyH;AACzH,wBAAgB,eAAe,IAAI,SAAS,GAAG,IAAI,CAkBlD;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAKnD;AAED,0GAA0G;AAC1G,wBAAgB,MAAM,CAAC,CAAC,EACtB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,KAAK,iBAAiB,CAAC,GAAG,SAAS,EACzE,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAC3B,MAAM,IAAI,CAUZ;AAKD,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAI9D;AAED,8CAA8C;AAC9C,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,30 @@
1
+ /** What can be asked for. */
2
+ export type PermissionKind = 'camera' | 'microphone' | 'notifications';
3
+ /** `granted`; `denied` (not granted yet: asking may still show the dialog); `blocked` (only the settings can grant it). */
4
+ export type PermissionStatus = 'granted' | 'denied' | 'blocked';
5
+ export type PermissionStatuses<K extends PermissionKind = PermissionKind> = {
6
+ [P in K]: PermissionStatus;
7
+ };
8
+ /**
9
+ * Ask for these permissions, showing the system's dialogs for those not granted yet. Resolves with each one's status;
10
+ * never rejects.
11
+ */
12
+ export declare function requestMediaPermissions<K extends PermissionKind>(kinds: readonly K[]): Promise<PermissionStatuses<K>>;
13
+ /** Each permission's status now, without asking. Never rejects. */
14
+ export declare function checkMediaPermissions<K extends PermissionKind>(kinds: readonly K[]): Promise<PermissionStatuses<K>>;
15
+ export interface Permissions<K extends PermissionKind = PermissionKind> {
16
+ /** Each permission's status; null until first checked. Checked again whenever the app comes back to the front. */
17
+ statuses: PermissionStatuses<K> | null;
18
+ /** Every one granted. */
19
+ granted: boolean;
20
+ /** Ask for those not granted (the system's dialogs); resolves with the statuses. */
21
+ request(): Promise<PermissionStatuses<K>>;
22
+ /** Check again without asking. */
23
+ refresh(): Promise<PermissionStatuses<K>>;
24
+ }
25
+ /**
26
+ * The status of these permissions, checked on mount and whenever the app returns to the front (the user may have
27
+ * changed them in the settings), with `request()` to ask for them.
28
+ */
29
+ export declare function usePermissions<K extends PermissionKind>(kinds: readonly K[]): Permissions<K>;
30
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/permissions.ts"],"names":[],"mappings":"AAkBA,6BAA6B;AAC7B,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,eAAe,CAAC;AAEvE,2HAA2H;AAC3H,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhE,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,IAAI;KAAG,CAAC,IAAI,CAAC,GAAG,gBAAgB;CAAE,CAAC;AAa3G;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAmB3H;AAED,mEAAmE;AACnE,wBAAsB,qBAAqB,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAoBzH;AAoCD,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc;IACpE,kHAAkH;IAClH,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACvC,yBAAyB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,oFAAoF;IACpF,OAAO,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,kCAAkC;IAClC,OAAO,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAgC5F"}
@@ -0,0 +1,4 @@
1
+ import { type ClientPlatform } from '@voltkit-rtc/client';
2
+ /** The Android platform. One per process (platform/index.ts). */
3
+ export declare function androidPlatform(): ClientPlatform;
4
+ //# sourceMappingURL=android.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../../../src/platform/android.ts"],"names":[],"mappings":"AAQA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA4EpE,iEAAiE;AACjE,wBAAgB,eAAe,IAAI,cAAc,CA0ChD"}
@@ -0,0 +1,101 @@
1
+ import { type ClientPlatform, type DeviceEnv, type EncodingInfoProbe } from '@voltkit-rtc/client';
2
+ import { type MediaPermissionKind } from '../errors.js';
3
+ /**
4
+ * The DOM's media types as the client declares them. This package compiles without the DOM library (React Native has
5
+ * none), so they are taken from the client's own declarations rather than named.
6
+ */
7
+ export type UserMediaConstraints = Parameters<NonNullable<ClientPlatform['getUserMedia']>>[0];
8
+ export type ClientStream = ReturnType<ClientPlatform['createStream']>;
9
+ export type ClientTrack = Parameters<ClientPlatform['stopTrack']>[0];
10
+ /**
11
+ * `ClientPlatform.adoptAppStream` (optional in @voltkit-rtc/client 0.9.12; this platform always provides it): the
12
+ * client is taking tracks from `stream`, a stream the app gave it (`publish(stream)`, `publishScreen({ stream })`),
13
+ * and will stop and release those tracks but never the stream, which is the app's. This platform then takes each track
14
+ * out of that stream before releasing it, so the app can release its stream after unpublish() or close() without
15
+ * react-native-webrtc 155 killing the app (Phase 0 finding 1). useLocalMedia().publish() is safe either way (its
16
+ * capture is made and released here).
17
+ */
18
+ export interface AppStreamHook {
19
+ adoptAppStream(stream: ClientStream): void;
20
+ }
21
+ /**
22
+ * The settings a track reports: react-native-webrtc's `MediaTrackSettings` (the web's has these fields too). A camera
23
+ * says its `width`, `height`, `frameRate`, `facingMode` (`'user'` or `'environment'`) and `deviceId`.
24
+ */
25
+ export interface MediaTrackSettingsLike {
26
+ width?: number;
27
+ height?: number;
28
+ frameRate?: number;
29
+ facingMode?: string;
30
+ deviceId?: string;
31
+ groupId?: string;
32
+ }
33
+ /**
34
+ * A media track by shape: react-native-webrtc's `MediaStreamTrack`, which every track this package hands out is
35
+ * (`useLocalMedia().stream?.getVideoTracks()[0]`), and the web's `MediaStreamTrack` as `@voltkit-rtc/client` types a
36
+ * remote track's `track`, which fits the same shape, so either goes into `VideoTrack` and `AudioTrack` as it is. Typed by
37
+ * shape so an app compiles without the DOM library (`@react-native/typescript-config` leaves it out, and the only
38
+ * `MediaStream` it then knows is an empty stub). `remote` and `release` are react-native-webrtc's: a received track, and
39
+ * freeing the native track, which the SDK does for its own tracks.
40
+ */
41
+ export interface MediaStreamTrackLike {
42
+ readonly id: string;
43
+ /** `'audio'` or `'video'`. */
44
+ readonly kind: string;
45
+ /** `'live'` or `'ended'`. */
46
+ readonly readyState: string;
47
+ enabled: boolean;
48
+ stop(): void;
49
+ getSettings(): MediaTrackSettingsLike;
50
+ getConstraints(): object;
51
+ applyConstraints(constraints?: object): Promise<void>;
52
+ readonly remote?: boolean;
53
+ release?(): void;
54
+ }
55
+ /**
56
+ * A media stream by shape: react-native-webrtc's `MediaStream`, which `useLocalMedia().stream` and `screenStream`
57
+ * are. Typed by shape for the same reason as `MediaStreamTrackLike`. `toURL()` is what an `RTCView` plays (`VideoTrack`
58
+ * does this), and `release()` frees the native stream: never call it on a stream the SDK made (see `VideoTrack`).
59
+ */
60
+ export interface MediaStreamLike {
61
+ readonly id: string;
62
+ readonly active: boolean;
63
+ getTracks(): MediaStreamTrackLike[];
64
+ getAudioTracks(): MediaStreamTrackLike[];
65
+ getVideoTracks(): MediaStreamTrackLike[];
66
+ addTrack(track: MediaStreamTrackLike): void;
67
+ removeTrack(track: MediaStreamTrackLike): void;
68
+ toURL(): string;
69
+ release(releaseTracks?: boolean): void;
70
+ }
71
+ /** The client's own stream (`client.local`), typed as react-native-webrtc's. */
72
+ export declare function localStream(client: {
73
+ readonly local: unknown;
74
+ }): MediaStreamLike | null;
75
+ /** getDiagnostics().userAgent: `ReactNative android 37; react-native-webrtc 155.0.1; @voltkit-rtc/react-native 0.1.1`. */
76
+ export declare function describePlatform(): string;
77
+ /**
78
+ * What the client reads to pick its defaults: a phone or tablet, so two simulcast layers and the H.264 decision
79
+ * (there is no user agent in React Native, which gave phones a computer's three layers).
80
+ */
81
+ export declare function deviceEnv(): DeviceEnv;
82
+ /**
83
+ * Whether H.264 is encoded in hardware, asked only for a phone whose WebRTC can send H.264 at all. On Android
84
+ * react-native-webrtc's libwebrtc has no software H.264 encoder (the emulator, without a hardware one, offers none), so
85
+ * a device that offers it encodes it in hardware: 'auto' then sends H.264, as the Android SDK does.
86
+ */
87
+ export declare const hardwareH264: EncodingInfoProbe;
88
+ /** The kinds a capture asks for, as permissions. */
89
+ export declare function kindsOf(constraints: {
90
+ audio?: unknown;
91
+ video?: unknown;
92
+ }): MediaPermissionKind[];
93
+ /**
94
+ * Capture a camera and/or microphone through react-native-webrtc (ClientPlatform.getUserMedia). The permissions are
95
+ * checked first, without asking (a reconnect in the background must not open a dialog): one not granted rejects with
96
+ * `media-unavailable` `{ permission, status }` and nothing opens. react-native-webrtc drops a kind whose permission was
97
+ * refused without an error, so a stream missing a kind asked for is released and refused the same way. The stream is
98
+ * kept in the book, so it is released once its tracks are stopped.
99
+ */
100
+ export declare function captureUserMedia(constraints: UserMediaConstraints): Promise<ClientStream>;
101
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/platform/common.ts"],"names":[],"mappings":"AAKA,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG5G,OAAO,EAAmD,KAAK,mBAAmB,EAAE,MAAM,cAAW,CAAC;AAItG;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9F,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC;AACtE,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAGrE;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,C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gB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,SAAS,CAGrC;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,iBAAyG,CAAC;AAErI,oDAAoD;AACpD,wBAAgB,OAAO,CAAC,WAAW,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,mBAAmB,EAAE,CAKhG;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6B/F"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Cameras, microphones and audio outputs.
3
+ *
4
+ * Cameras come from react-native-webrtc (ids "0", "1", ... with a facing), named as the Android SDK names them ("Front
5
+ * camera", "Back camera 2"). On Android the audio devices come from this package's audio router (speaker, earpiece,
6
+ * wired and USB headsets, Bluetooth, each with its `type`), which also routes sound and picks the microphone natively;
7
+ * without the native module, and on iOS, from react-native-webrtc's list.
8
+ *
9
+ * A camera is switched on its own track (react-native-webrtc's applyConstraints with the deviceId): the same track and
10
+ * producer, so nothing can fail half-way. react-native-webrtc falls back to the facing mode, without an error, for an
11
+ * id it does not know, so the id is checked against the list first (`bad-params`) and the camera it ended up on is
12
+ * checked after (`camera-failed`); the old camera keeps capturing either way.
13
+ */
14
+ import { type DeviceKind, type MediaDevice } from '@voltkit-rtc/client';
15
+ import type { Spec } from '../specs/NativeVoltkitRtc.js';
16
+ /** The cameras, front ones first, labelled as the Android SDK labels them. */
17
+ export declare function listCameras(): Promise<MediaDevice[]>;
18
+ /** Every device, or those of one kind (ClientPlatform.enumerateDevices). */
19
+ export declare function enumerateDevices(module: Spec | null, kind?: DeviceKind): Promise<MediaDevice[]>;
20
+ /** Hear audio devices come and go (Android's router); cameras cannot be watched. */
21
+ export declare function onDeviceChange(module: Spec | null, listener: () => void): (() => void) | null;
22
+ /**
23
+ * Route sound to an output, or record from a microphone, natively (ClientPlatform.routeAudio). Outputs: true when
24
+ * routed, false when it cannot be chosen (the client then rejects with `bad-params`). Microphones: true when the audio
25
+ * device module records from it now; `bad-params` for one the router does not list; false (the client captures it)
26
+ * where the module cannot choose.
27
+ */
28
+ export declare function routeAudio(module: Spec, kind: 'audioinput' | 'audiooutput', deviceId: string): Promise<boolean>;
29
+ /** react-native-webrtc's camera track, as far as switching needs it. */
30
+ interface CameraTrack {
31
+ readonly kind: string;
32
+ getSettings(): {
33
+ deviceId?: unknown;
34
+ facingMode?: unknown;
35
+ };
36
+ getConstraints(): Record<string, unknown>;
37
+ applyConstraints(constraints: Record<string, unknown>): Promise<void>;
38
+ }
39
+ /** Turn the camera behind `track` to `deviceId`, on the same track (ClientPlatform.switchCameraInPlace). */
40
+ export declare function switchCameraInPlace(track: CameraTrack, deviceId: string): Promise<void>;
41
+ export {};
42
+ //# sourceMappingURL=devices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devices.d.ts","sourceRoot":"","sources":["../../../../src/platform/devices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAA+B,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA2B,CAAC;AA4BtD,8EAA8E;AAC9E,wBAAsB,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAa1D;AAyBD,4EAA4E;AAC5E,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CASrG;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAG7F;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,GAAG,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAarH;AAED,wEAAwE;AACxE,UAAU,WAAW;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,WAAW,IAAI;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5D,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE;AAED,4GAA4G;AAC5G,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB7F"}
@@ -0,0 +1,6 @@
1
+ import type { ClientPlatform } from '@voltkit-rtc/client';
2
+ /** The React Native platform for this app (Android, or the iOS preview). The same object every time. */
3
+ export declare function reactNativePlatform(): ClientPlatform;
4
+ export { streamBook } from './streams.js';
5
+ export type { StreamBook, ViewHandle } from './streams.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/platform/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAM1D,wGAAwG;AACxG,wBAAgB,mBAAmB,IAAI,cAAc,CAKpD;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,cAAW,CAAC;AACvC,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ClientPlatform } from '@voltkit-rtc/client';
2
+ import { type AppStreamHook } from './common.js';
3
+ export declare function iosPlatform(): ClientPlatform & AppStreamHook;
4
+ //# sourceMappingURL=ios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../src/platform/ios.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAiD,KAAK,aAAa,EAAuC,MAAM,aAAU,CAAC;AAMlI,wBAAgB,WAAW,IAAI,cAAc,GAAG,aAAa,CAgC5D"}
@@ -0,0 +1,82 @@
1
+ /** What this module needs of a track: react-native-webrtc's MediaStreamTrack, or a test's stand-in. */
2
+ export interface TrackLike {
3
+ readonly id: string;
4
+ readonly kind: string;
5
+ readonly remote?: boolean;
6
+ readonly readyState: string;
7
+ enabled: boolean;
8
+ stop(): void;
9
+ release?(): void;
10
+ }
11
+ /** What this module needs of a stream: react-native-webrtc's MediaStream. */
12
+ export interface StreamLike {
13
+ getTracks(): TrackLike[];
14
+ removeTrack(track: TrackLike): void;
15
+ release(releaseTracks?: boolean): void;
16
+ toURL(): string;
17
+ }
18
+ /**
19
+ * Why a stream is kept: a capture (getUserMedia, getDisplayMedia), the client's own (createStream), a view, or the
20
+ * app's own that the client publishes (adoptAppStream: tracks taken out of it, never released here).
21
+ */
22
+ export type StreamRole = 'capture' | 'client' | 'view' | 'app';
23
+ /** One view's hold on a track's wrapper stream. */
24
+ export interface ViewHandle {
25
+ /** The wrapper's URL, for RTCView's streamURL. */
26
+ readonly url: string;
27
+ /** Called when the wrapper goes before this view lets go of it (the track was stopped or detached). */
28
+ onEnd(listener: () => void): () => void;
29
+ /** This view is done; the wrapper is released when the last view of the track lets go. */
30
+ release(): void;
31
+ }
32
+ export declare class StreamBook {
33
+ private readonly makeStream;
34
+ private readonly live;
35
+ private readonly entries;
36
+ private readonly views;
37
+ /** Local tracks this package disposed (released). */
38
+ private readonly disposed;
39
+ /** Remote tracks whose connection is closing: no new view, their wrappers already released. */
40
+ private readonly detached;
41
+ private readonly stopped;
42
+ private readonly screens;
43
+ /** Streams left unreleased because releasing them would have crashed the app. */
44
+ leaked: number;
45
+ /** Called after a screen track is stopped and released (react-native-webrtc's MediaProjectionService then stops). */
46
+ onScreenStopped: (() => void) | null;
47
+ constructor(makeStream: (tracks: TrackLike[]) => StreamLike);
48
+ /** Keep `stream`, one the platform made (or the app's, `app`), to let go of in the right order. */
49
+ adopt(stream: StreamLike, role: StreamRole): void;
50
+ /** A stream of these tracks for the client's own use (ClientPlatform.createStream). */
51
+ create(tracks: TrackLike[]): StreamLike;
52
+ /** The tracks of `stream` are a screen capture's. */
53
+ markScreen(stream: StreamLike): void;
54
+ /** Release `stream` without its tracks (ClientPlatform.releaseStream). Again does nothing. */
55
+ release(stream: StreamLike): void;
56
+ /**
57
+ * Stop and release `track` (ClientPlatform.stopTrack): its view wrappers are released and it leaves every stream
58
+ * kept here first (made here, or the app's adopted), while the native track still exists. Again does nothing. A
59
+ * remote track is only let go of: its connection owns it.
60
+ */
61
+ stop(track: TrackLike): void;
62
+ /**
63
+ * The client is about to close what receives these remote tracks (ClientPlatform.detachTracks): release their
64
+ * wrappers now, while their peer connection still exists, and make no new ones.
65
+ */
66
+ detach(tracks: readonly TrackLike[]): void;
67
+ /** A view of `track` (VideoTrack), or null when it cannot be shown: ended, stopped or detached. */
68
+ view(track: TrackLike): ViewHandle | null;
69
+ /** How many streams made here are not released yet, how many tracks have views, and how many were left unreleased. */
70
+ stats(): {
71
+ live: number;
72
+ views: number;
73
+ leaked: number;
74
+ };
75
+ /** A track the native side may no longer have: disposed here, or remote and ended (its connection closed). */
76
+ private unsafe;
77
+ private dropViews;
78
+ private releaseEntry;
79
+ }
80
+ /** The process's book of streams (one for every client and view). */
81
+ export declare function streamBook(): StreamBook;
82
+ //# sourceMappingURL=streams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../../../../src/platform/streams.ts"],"names":[],"mappings":"AA6BA,uG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C,QAAQ,CAAC,OAAO,CAAyB;IACjD,iFAAiF;IACjF,MAAM,SAAK;IACX,qHAAqH;IACrH,eAAe,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAQ;gBAEf,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,UAAU;IAE5E,mGAAmG;IACnG,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAYjD,uFAAuF;IACvF,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU;IAMvC,qDAAqD;IACrD,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAIpC,8FAA8F;IAC9F,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAUjC;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAyC5B;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI;IAO1C,mGAAmG;IACnG,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,GAAG,IAAI;IAuCzC,sHAAsH;IACtH,KAAK,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAIxD,8GAA8G;IAC9G,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,SAAS;IAcjB,OAAO,CAAC,YAAY;CAoBrB;AAID,qEAAqE;AACrE,wBAAgB,UAAU,IAAI,UAAU,CASvC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The timers the client's own work runs on (reconnect backoff, socket liveness, request deadlines, sampling).
3
+ *
4
+ * React Native's JavaScript timers run on Choreographer frames, which stop when the app leaves the foreground, when
5
+ * the screen goes off even with the app in front, and while a permission dialog is open (Phase 0 S5): a call whose
6
+ * timers stop cannot notice a dead socket or reconnect. On Android they wait natively instead (the module's
7
+ * timerStart/timerStop on a thread of their own) and fire back through its onTimer event, which reaches JavaScript
8
+ * whether frames run or not. Without the native module (iOS, Expo Go) they are JavaScript's own.
9
+ */
10
+ import type { PlatformTimers } from '@voltkit-rtc/client';
11
+ import type { Spec } from '../specs/NativeVoltkitRtc.js';
12
+ /** JavaScript's own timers, looked up at each call (a test's fake clock replaces them, and is used). */
13
+ export declare const jsTimers: PlatformTimers;
14
+ /**
15
+ * Timers that wait natively. Ids are this side's and never reused, so a fire already on its way for a timer stopped
16
+ * since is recognised and ignored. One onTimer subscription for the whole process.
17
+ */
18
+ export declare function nativeTimers(module: Spec): PlatformTimers;
19
+ //# sourceMappingURL=timers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timers.d.ts","sourceRoot":"","sources":["../../../../src/platform/timers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA2B,CAAC;AAItD,wGAAwG;AACxG,eAAO,MAAM,QAAQ,EAAE,cAKrB,CAAC;AAOH;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,GAAG,cAAc,CAwCzD"}
@@ -0,0 +1,11 @@
1
+ import type { Spec } from '../specs/NativeVoltkitRtc.js';
2
+ export interface Visibility {
3
+ visible(): boolean;
4
+ /** Hear every change; returns the function that stops. */
5
+ subscribe(listener: (visible: boolean) => void): () => void;
6
+ }
7
+ /** From the process lifecycle (Android). */
8
+ export declare function nativeVisibility(module: Spec): Visibility;
9
+ /** From AppState: `active` and `inactive` are visible, `background` is not. */
10
+ export declare function appStateVisibility(): Visibility;
11
+ //# sourceMappingURL=visibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../../src/platform/visibility.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA2B,CAAC;AAItD,MAAM,WAAW,UAAU;IACzB,OAAO,IAAI,OAAO,CAAC;IACnB,0DAA0D;IAC1D,SAAS,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7D;AAID,4CAA4C;AAC5C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,IAAI,GAAG,UAAU,CAYzD;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,IAAI,UAAU,CAkB/C"}