@livekit/react-native 2.9.6 → 2.9.8
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.
- package/README.md +7 -5
- package/ios/LivekitReactNative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/LivekitReactNative.xcodeproj/xcuserdata/davidliu.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/lib/commonjs/LKNativeModule.js.map +1 -1
- package/lib/commonjs/audio/AudioManager.js +1 -2
- package/lib/commonjs/audio/AudioManager.js.map +1 -1
- package/lib/commonjs/audio/AudioSession.js +105 -100
- package/lib/commonjs/audio/AudioSession.js.map +1 -1
- package/lib/commonjs/audio/MediaRecorder.js +54 -35
- package/lib/commonjs/audio/MediaRecorder.js.map +1 -1
- package/lib/commonjs/components/BarVisualizer.js +8 -8
- package/lib/commonjs/components/BarVisualizer.js.map +1 -1
- package/lib/commonjs/components/LiveKitRoom.js +11 -7
- package/lib/commonjs/components/LiveKitRoom.js.map +1 -1
- package/lib/commonjs/components/VideoTrack.js +34 -47
- package/lib/commonjs/components/VideoTrack.js.map +1 -1
- package/lib/commonjs/components/VideoView.js +36 -48
- package/lib/commonjs/components/VideoView.js.map +1 -1
- package/lib/commonjs/components/ViewPortDetector.js +71 -79
- package/lib/commonjs/components/ViewPortDetector.js.map +1 -1
- package/lib/commonjs/e2ee/RNE2EEManager.js +8 -15
- package/lib/commonjs/e2ee/RNE2EEManager.js.map +1 -1
- package/lib/commonjs/e2ee/RNKeyProvider.js +1 -5
- package/lib/commonjs/e2ee/RNKeyProvider.js.map +1 -1
- package/lib/commonjs/events/EventEmitter.js +2 -4
- package/lib/commonjs/events/EventEmitter.js.map +1 -1
- package/lib/commonjs/hooks/useE2EEManager.js.map +1 -1
- package/lib/commonjs/hooks/useMultibandTrackVolume.js +4 -5
- package/lib/commonjs/hooks/useMultibandTrackVolume.js.map +1 -1
- package/lib/commonjs/hooks/useTrackVolume.js +4 -5
- package/lib/commonjs/hooks/useTrackVolume.js.map +1 -1
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/index.js +15 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logger.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/polyfills/EncoderDecoderTogether.min.js.map +1 -1
- package/lib/commonjs/polyfills/MediaRecorderShim.js.map +1 -1
- package/lib/commonjs/useParticipant.js.map +1 -1
- package/lib/commonjs/useRoom.js +4 -6
- package/lib/commonjs/useRoom.js.map +1 -1
- package/lib/module/LKNativeModule.js +2 -0
- package/lib/module/LKNativeModule.js.map +1 -1
- package/lib/module/audio/AudioManager.js +2 -0
- package/lib/module/audio/AudioManager.js.map +1 -1
- package/lib/module/audio/AudioSession.js +107 -100
- package/lib/module/audio/AudioSession.js.map +1 -1
- package/lib/module/audio/MediaRecorder.js +50 -29
- package/lib/module/audio/MediaRecorder.js.map +1 -1
- package/lib/module/components/BarVisualizer.js +9 -6
- package/lib/module/components/BarVisualizer.js.map +1 -1
- package/lib/module/components/LiveKitRoom.js +12 -6
- package/lib/module/components/LiveKitRoom.js.map +1 -1
- package/lib/module/components/VideoTrack.js +35 -45
- package/lib/module/components/VideoTrack.js.map +1 -1
- package/lib/module/components/VideoView.js +37 -46
- package/lib/module/components/VideoView.js.map +1 -1
- package/lib/module/components/ViewPortDetector.js +71 -77
- package/lib/module/components/ViewPortDetector.js.map +1 -1
- package/lib/module/e2ee/RNE2EEManager.js +10 -15
- package/lib/module/e2ee/RNE2EEManager.js.map +1 -1
- package/lib/module/e2ee/RNKeyProvider.js +3 -5
- package/lib/module/e2ee/RNKeyProvider.js.map +1 -1
- package/lib/module/events/EventEmitter.js +4 -4
- package/lib/module/events/EventEmitter.js.map +1 -1
- package/lib/module/hooks/useE2EEManager.js +2 -0
- package/lib/module/hooks/useE2EEManager.js.map +1 -1
- package/lib/module/hooks/useMultibandTrackVolume.js +6 -5
- package/lib/module/hooks/useMultibandTrackVolume.js.map +1 -1
- package/lib/module/hooks/useTrackVolume.js +6 -5
- package/lib/module/hooks/useTrackVolume.js.map +1 -1
- package/lib/module/hooks.js +2 -0
- package/lib/module/hooks.js.map +1 -1
- package/lib/module/index.js +5 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/logger.js +2 -0
- package/lib/module/logger.js.map +1 -1
- package/lib/module/polyfills/EncoderDecoderTogether.min.js.map +1 -1
- package/lib/module/polyfills/MediaRecorderShim.js +2 -0
- package/lib/module/polyfills/MediaRecorderShim.js.map +1 -1
- package/lib/module/useParticipant.js +2 -0
- package/lib/module/useParticipant.js.map +1 -1
- package/lib/module/useRoom.js +6 -6
- package/lib/module/useRoom.js.map +1 -1
- package/lib/typescript/{LKNativeModule.d.ts → src/LKNativeModule.d.ts} +1 -0
- package/lib/typescript/src/LKNativeModule.d.ts.map +1 -0
- package/lib/typescript/{audio → src/audio}/AudioManager.d.ts +1 -0
- package/lib/typescript/src/audio/AudioManager.d.ts.map +1 -0
- package/lib/typescript/{audio → src/audio}/AudioSession.d.ts +1 -0
- package/lib/typescript/src/audio/AudioSession.d.ts.map +1 -0
- package/lib/typescript/{audio → src/audio}/MediaRecorder.d.ts +14 -1
- package/lib/typescript/src/audio/MediaRecorder.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/BarVisualizer.d.ts +2 -2
- package/lib/typescript/src/components/BarVisualizer.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/LiveKitRoom.d.ts +2 -1
- package/lib/typescript/src/components/LiveKitRoom.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/VideoTrack.d.ts +2 -2
- package/lib/typescript/src/components/VideoTrack.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/VideoView.d.ts +2 -2
- package/lib/typescript/src/components/VideoView.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/ViewPortDetector.d.ts +3 -2
- package/lib/typescript/src/components/ViewPortDetector.d.ts.map +1 -0
- package/lib/typescript/{e2ee → src/e2ee}/RNE2EEManager.d.ts +1 -0
- package/lib/typescript/src/e2ee/RNE2EEManager.d.ts.map +1 -0
- package/lib/typescript/{e2ee → src/e2ee}/RNKeyProvider.d.ts +1 -0
- package/lib/typescript/src/e2ee/RNKeyProvider.d.ts.map +1 -0
- package/lib/typescript/{events → src/events}/EventEmitter.d.ts +1 -0
- package/lib/typescript/src/events/EventEmitter.d.ts.map +1 -0
- package/lib/typescript/{hooks → src/hooks}/useE2EEManager.d.ts +1 -0
- package/lib/typescript/src/hooks/useE2EEManager.d.ts.map +1 -0
- package/lib/typescript/{hooks → src/hooks}/useMultibandTrackVolume.d.ts +1 -0
- package/lib/typescript/src/hooks/useMultibandTrackVolume.d.ts.map +1 -0
- package/lib/typescript/{hooks → src/hooks}/useTrackVolume.d.ts +1 -0
- package/lib/typescript/src/hooks/useTrackVolume.d.ts.map +1 -0
- package/lib/typescript/{hooks.d.ts → src/hooks.d.ts} +1 -0
- package/lib/typescript/src/hooks.d.ts.map +1 -0
- package/lib/typescript/{index.d.ts → src/index.d.ts} +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/{logger.d.ts → src/logger.d.ts} +1 -0
- package/lib/typescript/src/logger.d.ts.map +1 -0
- package/lib/typescript/src/polyfills/MediaRecorderShim.d.ts +2 -0
- package/lib/typescript/src/polyfills/MediaRecorderShim.d.ts.map +1 -0
- package/lib/typescript/{useParticipant.d.ts → src/useParticipant.d.ts} +1 -0
- package/lib/typescript/src/useParticipant.d.ts.map +1 -0
- package/lib/typescript/{useRoom.d.ts → src/useRoom.d.ts} +1 -0
- package/lib/typescript/src/useRoom.d.ts.map +1 -0
- package/package.json +40 -57
- package/src/audio/MediaRecorder.ts +54 -17
- package/src/components/BarVisualizer.tsx +2 -2
- package/src/components/VideoTrack.tsx +0 -2
- package/src/components/VideoView.tsx +0 -2
- package/src/components/ViewPortDetector.tsx +1 -1
- package/src/index.tsx +1 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -7
- package/android/gradlew +0 -249
- package/android/gradlew.bat +0 -92
- package/android/local.properties +0 -8
- package/lib/typescript/polyfills/EncoderDecoderTogether.min.d.ts +0 -0
- package/lib/typescript/polyfills/MediaRecorderShim.d.ts +0 -1
package/README.md
CHANGED
|
@@ -472,12 +472,14 @@ Apache License 2.0
|
|
|
472
472
|
<br/><table>
|
|
473
473
|
<thead><tr><th colspan="2">LiveKit Ecosystem</th></tr></thead>
|
|
474
474
|
<tbody>
|
|
475
|
-
<tr><td>
|
|
476
|
-
<tr><td>
|
|
475
|
+
<tr><td>Agents SDKs</td><td><a href="https://github.com/livekit/agents">Python</a> · <a href="https://github.com/livekit/agents-js">Node.js</a></td></tr><tr></tr>
|
|
476
|
+
<tr><td>LiveKit SDKs</td><td><a href="https://github.com/livekit/client-sdk-js">Browser</a> · <a href="https://github.com/livekit/client-sdk-swift">Swift</a> · <a href="https://github.com/livekit/client-sdk-android">Android</a> · <a href="https://github.com/livekit/client-sdk-flutter">Flutter</a> · <b>React Native</b> · <a href="https://github.com/livekit/rust-sdks">Rust</a> · <a href="https://github.com/livekit/node-sdks">Node.js</a> · <a href="https://github.com/livekit/python-sdks">Python</a> · <a href="https://github.com/livekit/client-sdk-unity">Unity</a> · <a href="https://github.com/livekit/client-sdk-unity-web">Unity (WebGL)</a> · <a href="https://github.com/livekit/client-sdk-esp32">ESP32</a> · <a href="https://github.com/livekit/client-sdk-cpp">C++</a></td></tr><tr></tr>
|
|
477
|
+
<tr><td>Starter Apps</td><td><a href="https://github.com/livekit-examples/agent-starter-python">Python Agent</a> · <a href="https://github.com/livekit-examples/agent-starter-node">TypeScript Agent</a> · <a href="https://github.com/livekit-examples/agent-starter-react">React App</a> · <a href="https://github.com/livekit-examples/agent-starter-swift">SwiftUI App</a> · <a href="https://github.com/livekit-examples/agent-starter-android">Android App</a> · <a href="https://github.com/livekit-examples/agent-starter-flutter">Flutter App</a> · <a href="https://github.com/livekit-examples/agent-starter-react-native">React Native App</a> · <a href="https://github.com/livekit-examples/agent-starter-embed">Web Embed</a></td></tr><tr></tr>
|
|
477
478
|
<tr><td>UI Components</td><td><a href="https://github.com/livekit/components-js">React</a> · <a href="https://github.com/livekit/components-android">Android Compose</a> · <a href="https://github.com/livekit/components-swift">SwiftUI</a> · <a href="https://github.com/livekit/components-flutter">Flutter</a></td></tr><tr></tr>
|
|
478
|
-
<tr><td>
|
|
479
|
-
<tr><td>
|
|
480
|
-
<tr><td>
|
|
479
|
+
<tr><td>Server APIs</td><td><a href="https://github.com/livekit/node-sdks">Node.js</a> · <a href="https://github.com/livekit/server-sdk-go">Golang</a> · <a href="https://github.com/livekit/server-sdk-ruby">Ruby</a> · <a href="https://github.com/livekit/server-sdk-kotlin">Java/Kotlin</a> · <a href="https://github.com/livekit/python-sdks">Python</a> · <a href="https://github.com/livekit/rust-sdks">Rust</a> · <a href="https://github.com/agence104/livekit-server-sdk-php">PHP (community)</a> · <a href="https://github.com/pabloFuente/livekit-server-sdk-dotnet">.NET (community)</a></td></tr><tr></tr>
|
|
480
|
+
<tr><td>Resources</td><td><a href="https://docs.livekit.io">Docs</a> · <a href="https://docs.livekit.io/mcp">Docs MCP Server</a> · <a href="https://github.com/livekit/livekit-cli">CLI</a> · <a href="https://cloud.livekit.io">LiveKit Cloud</a></td></tr><tr></tr>
|
|
481
|
+
<tr><td>LiveKit Server OSS</td><td><a href="https://github.com/livekit/livekit">LiveKit server</a> · <a href="https://github.com/livekit/egress">Egress</a> · <a href="https://github.com/livekit/ingress">Ingress</a> · <a href="https://github.com/livekit/sip">SIP</a></td></tr><tr></tr>
|
|
482
|
+
<tr><td>Community</td><td><a href="https://community.livekit.io">Developer Community</a> · <a href="https://livekit.io/join-slack">Slack</a> · <a href="https://x.com/livekit">X</a> · <a href="https://www.youtube.com/@livekit_io">YouTube</a></td></tr>
|
|
481
483
|
</tbody>
|
|
482
484
|
</table>
|
|
483
485
|
<!--END_REPO_NAV-->
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>LivekitReactNative.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","LiveKitModule","NativeModules","LivekitReactNativeModule","Proxy","get","Error","_default","exports"],"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","LiveKitModule","NativeModules","LivekitReactNativeModule","Proxy","get","Error","_default","exports"],"sourceRoot":"../../src","sources":["LKNativeModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,MAAMC,aAAa,GACjB,gFAAgF,GAChFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,aAAa,GAAGC,0BAAa,CAACC,wBAAwB,GACxDD,0BAAa,CAACC,wBAAwB,GACtC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAESC,aAAa","ignoreList":[]}
|
|
@@ -9,8 +9,7 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _livekitClient = require("livekit-client");
|
|
10
10
|
var _AudioSession = _interopRequireWildcard(require("./AudioSession"));
|
|
11
11
|
var _ = require("..");
|
|
12
|
-
function
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
13
|
/**
|
|
15
14
|
* Handles setting the appropriate AVAudioSession options automatically
|
|
16
15
|
* depending on the audio track states of the Room.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_livekitClient","_AudioSession","_interopRequireWildcard","_","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_livekitClient","_AudioSession","_interopRequireWildcard","_","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","useIOSAudioManagement","room","preferSpeakerOutput","onConfigureNativeAudio","localTrackCount","setLocalTrackCount","useState","remoteTrackCount","setRemoteTrackCount","trackState","useMemo","computeAudioTrackState","useEffect","recalculateTrackCounts","getLocalAudioTrackCount","getRemoteAudioTrackCount","on","RoomEvent","Connected","off","Platform","OS","onLocalPublished","publication","kind","onLocalUnpublished","log","warn","Math","max","onRemotePublished","onRemoteUnpublished","LocalTrackPublished","LocalTrackUnpublished","TrackPublished","TrackUnpublished","configFunc","getDefaultAppleAudioConfigurationForMode","audioConfig","AudioSession","setAppleAudioConfiguration","localTracks","remoteTracks","localParticipant","audioTrackPublications","size","audioTracks","remoteParticipants","forEach","participant"],"sourceRoot":"../../../src","sources":["audio/AudioManager.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAMA,IAAAG,aAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAKA,IAAAK,CAAA,GAAAL,OAAA;AAAyB,SAAAI,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GA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EACpD,IAAI6C,WAAW,GAAG,CAAC;EACnB7C,IAAI,CAAC8C,kBAAkB,CAACC,OAAO,CAAEC,WAAW,IAAK;IAC/CH,WAAW,IAAIG,WAAW,CAACL,sBAAsB,CAACC,IAAI;EACxD,CAAC,CAAC;EACF,OAAOC,WAAW;AACpB","ignoreList":[]}
|
|
@@ -8,9 +8,6 @@ exports.getDefaultAppleAudioConfigurationForMode = getDefaultAppleAudioConfigura
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _LKNativeModule = _interopRequireDefault(require("../LKNativeModule"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
12
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
13
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
11
|
/**
|
|
15
12
|
* Configuration for the underlying AudioSession.
|
|
16
13
|
*
|
|
@@ -77,102 +74,110 @@ function getDefaultAppleAudioConfigurationForMode(mode, preferSpeakerOutput = tr
|
|
|
77
74
|
audioMode: 'default'
|
|
78
75
|
};
|
|
79
76
|
}
|
|
80
|
-
class AudioSession {
|
|
77
|
+
class AudioSession {
|
|
78
|
+
/**
|
|
79
|
+
* Applies the provided audio configuration to the underlying AudioSession.
|
|
80
|
+
*
|
|
81
|
+
* Must be called prior to connecting to a Room for the configuration to apply correctly.
|
|
82
|
+
*
|
|
83
|
+
* See also useIOSAudioManagement for automatic configuration of iOS audio options.
|
|
84
|
+
*/
|
|
85
|
+
static configureAudio = async config => {
|
|
86
|
+
await _LKNativeModule.default.configureAudio(config);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Starts an AudioSession.
|
|
91
|
+
*/
|
|
92
|
+
static startAudioSession = async () => {
|
|
93
|
+
await _LKNativeModule.default.startAudioSession();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Stops the existing AudioSession.
|
|
98
|
+
*/
|
|
99
|
+
static stopAudioSession = async () => {
|
|
100
|
+
await _LKNativeModule.default.stopAudioSession();
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Set default audio track volume when new tracks are subscribed.
|
|
105
|
+
* Does **not** affect any existing tracks.
|
|
106
|
+
*
|
|
107
|
+
* @param volume A number between 0.0 and 1.0, where 0.0 represents 0% volume and
|
|
108
|
+
* 1.0 represents full volume.
|
|
109
|
+
*/
|
|
110
|
+
static setDefaultRemoteAudioTrackVolume = async volume => {
|
|
111
|
+
await _LKNativeModule.default.setDefaultAudioTrackVolume(volume);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Gets the available audio outputs for use with {@link selectAudioOutput}.
|
|
116
|
+
*
|
|
117
|
+
* {@link startAudioSession} must be called prior to using this method.
|
|
118
|
+
*
|
|
119
|
+
* For Android, will return if available:
|
|
120
|
+
* * "speaker"
|
|
121
|
+
* * "earpiece"
|
|
122
|
+
* * "headset"
|
|
123
|
+
* * "bluetooth"
|
|
124
|
+
*
|
|
125
|
+
* ----
|
|
126
|
+
*
|
|
127
|
+
* For iOS, due to OS limitations, the only available types are:
|
|
128
|
+
* * "default" - Use default iOS audio routing
|
|
129
|
+
* * "force_speaker" - Force audio output through speaker
|
|
130
|
+
*
|
|
131
|
+
* See also {@link showAudioRoutePicker} to display a route picker that
|
|
132
|
+
* can choose between other audio devices (i.e. headset/bluetooth/airplay),
|
|
133
|
+
* or use a library like `react-native-avroutepicker` for a native platform
|
|
134
|
+
* control.
|
|
135
|
+
*
|
|
136
|
+
* @returns the available audio output types
|
|
137
|
+
*/
|
|
138
|
+
static getAudioOutputs = async () => {
|
|
139
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
140
|
+
return ['default', 'force_speaker'];
|
|
141
|
+
} else if (_reactNative.Platform.OS === 'android') {
|
|
142
|
+
return await _LKNativeModule.default.getAudioOutputs();
|
|
143
|
+
} else {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Select the provided audio output if available.
|
|
150
|
+
*
|
|
151
|
+
* {@link startAudioSession} must be called prior to using this method.
|
|
152
|
+
*
|
|
153
|
+
* @param deviceId A deviceId retrieved from {@link getAudioOutputs}
|
|
154
|
+
*/
|
|
155
|
+
static selectAudioOutput = async deviceId => {
|
|
156
|
+
await _LKNativeModule.default.selectAudioOutput(deviceId);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* iOS only, requires iOS 11+.
|
|
161
|
+
*
|
|
162
|
+
* Displays an AVRoutePickerView for the user to choose their audio output.
|
|
163
|
+
*/
|
|
164
|
+
static showAudioRoutePicker = async () => {
|
|
165
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
166
|
+
await _LKNativeModule.default.showAudioRoutePicker();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Directly change the AVAudioSession category/mode.
|
|
172
|
+
*
|
|
173
|
+
* @param config The configuration to use. Null values will be omitted and the
|
|
174
|
+
* existing values will be unchanged.
|
|
175
|
+
*/
|
|
176
|
+
static setAppleAudioConfiguration = async config => {
|
|
177
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
178
|
+
await _LKNativeModule.default.setAppleAudioConfiguration(config);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
81
182
|
exports.default = AudioSession;
|
|
82
|
-
/**
|
|
83
|
-
* Applies the provided audio configuration to the underlying AudioSession.
|
|
84
|
-
*
|
|
85
|
-
* Must be called prior to connecting to a Room for the configuration to apply correctly.
|
|
86
|
-
*
|
|
87
|
-
* See also useIOSAudioManagement for automatic configuration of iOS audio options.
|
|
88
|
-
*/
|
|
89
|
-
_defineProperty(AudioSession, "configureAudio", async config => {
|
|
90
|
-
await _LKNativeModule.default.configureAudio(config);
|
|
91
|
-
});
|
|
92
|
-
/**
|
|
93
|
-
* Starts an AudioSession.
|
|
94
|
-
*/
|
|
95
|
-
_defineProperty(AudioSession, "startAudioSession", async () => {
|
|
96
|
-
await _LKNativeModule.default.startAudioSession();
|
|
97
|
-
});
|
|
98
|
-
/**
|
|
99
|
-
* Stops the existing AudioSession.
|
|
100
|
-
*/
|
|
101
|
-
_defineProperty(AudioSession, "stopAudioSession", async () => {
|
|
102
|
-
await _LKNativeModule.default.stopAudioSession();
|
|
103
|
-
});
|
|
104
|
-
/**
|
|
105
|
-
* Set default audio track volume when new tracks are subscribed.
|
|
106
|
-
* Does **not** affect any existing tracks.
|
|
107
|
-
*
|
|
108
|
-
* @param volume A number between 0.0 and 1.0, where 0.0 represents 0% volume and
|
|
109
|
-
* 1.0 represents full volume.
|
|
110
|
-
*/
|
|
111
|
-
_defineProperty(AudioSession, "setDefaultRemoteAudioTrackVolume", async volume => {
|
|
112
|
-
await _LKNativeModule.default.setDefaultAudioTrackVolume(volume);
|
|
113
|
-
});
|
|
114
|
-
/**
|
|
115
|
-
* Gets the available audio outputs for use with {@link selectAudioOutput}.
|
|
116
|
-
*
|
|
117
|
-
* {@link startAudioSession} must be called prior to using this method.
|
|
118
|
-
*
|
|
119
|
-
* For Android, will return if available:
|
|
120
|
-
* * "speaker"
|
|
121
|
-
* * "earpiece"
|
|
122
|
-
* * "headset"
|
|
123
|
-
* * "bluetooth"
|
|
124
|
-
*
|
|
125
|
-
* ----
|
|
126
|
-
*
|
|
127
|
-
* For iOS, due to OS limitations, the only available types are:
|
|
128
|
-
* * "default" - Use default iOS audio routing
|
|
129
|
-
* * "force_speaker" - Force audio output through speaker
|
|
130
|
-
*
|
|
131
|
-
* See also {@link showAudioRoutePicker} to display a route picker that
|
|
132
|
-
* can choose between other audio devices (i.e. headset/bluetooth/airplay),
|
|
133
|
-
* or use a library like `react-native-avroutepicker` for a native platform
|
|
134
|
-
* control.
|
|
135
|
-
*
|
|
136
|
-
* @returns the available audio output types
|
|
137
|
-
*/
|
|
138
|
-
_defineProperty(AudioSession, "getAudioOutputs", async () => {
|
|
139
|
-
if (_reactNative.Platform.OS === 'ios') {
|
|
140
|
-
return ['default', 'force_speaker'];
|
|
141
|
-
} else if (_reactNative.Platform.OS === 'android') {
|
|
142
|
-
return await _LKNativeModule.default.getAudioOutputs();
|
|
143
|
-
} else {
|
|
144
|
-
return [];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
/**
|
|
148
|
-
* Select the provided audio output if available.
|
|
149
|
-
*
|
|
150
|
-
* {@link startAudioSession} must be called prior to using this method.
|
|
151
|
-
*
|
|
152
|
-
* @param deviceId A deviceId retrieved from {@link getAudioOutputs}
|
|
153
|
-
*/
|
|
154
|
-
_defineProperty(AudioSession, "selectAudioOutput", async deviceId => {
|
|
155
|
-
await _LKNativeModule.default.selectAudioOutput(deviceId);
|
|
156
|
-
});
|
|
157
|
-
/**
|
|
158
|
-
* iOS only, requires iOS 11+.
|
|
159
|
-
*
|
|
160
|
-
* Displays an AVRoutePickerView for the user to choose their audio output.
|
|
161
|
-
*/
|
|
162
|
-
_defineProperty(AudioSession, "showAudioRoutePicker", async () => {
|
|
163
|
-
if (_reactNative.Platform.OS === 'ios') {
|
|
164
|
-
await _LKNativeModule.default.showAudioRoutePicker();
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
/**
|
|
168
|
-
* Directly change the AVAudioSession category/mode.
|
|
169
|
-
*
|
|
170
|
-
* @param config The configuration to use. Null values will be omitted and the
|
|
171
|
-
* existing values will be unchanged.
|
|
172
|
-
*/
|
|
173
|
-
_defineProperty(AudioSession, "setAppleAudioConfiguration", async config => {
|
|
174
|
-
if (_reactNative.Platform.OS === 'ios') {
|
|
175
|
-
await _LKNativeModule.default.setAppleAudioConfiguration(config);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
183
|
//# sourceMappingURL=AudioSession.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_LKNativeModule","_interopRequireDefault","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","AndroidAudioTypePresets","exports","communication","manageAudioFocus","audioMode","audioFocusMode","audioStreamType","audioAttributesUsageType","audioAttributesContentType","media","getDefaultAppleAudioConfigurationForMode","mode","preferSpeakerOutput","audioCategory","audioCategoryOptions","AudioSession","config","LiveKitModule","configureAudio","startAudioSession","stopAudioSession","volume","setDefaultAudioTrackVolume","Platform","OS","getAudioOutputs","deviceId","selectAudioOutput","showAudioRoutePicker","setAppleAudioConfiguration"],"sources":["AudioSession.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport LiveKitModule from '../LKNativeModule';\n\n/**\n * Configuration for the underlying AudioSession.\n *\n * ----\n * Android specific options:\n *\n * * preferredOutputList - The preferred order in which to automatically select an audio output.\n * This is ignored when an output is manually selected with {@link AudioSession.selectAudioOutput}.\n *\n * By default, the order is set to:\n * 1. `\"bluetooth\"\n * 2. `\"headset\"``\n * 3. `\"speaker\"`\n * 4. `\"earpiece\"`\n *\n * * audioTypeOptions - An {@link AndroidAudioTypeOptions} object which provides the\n * audio options to use on Android.\n *\n * See {@link AndroidAudioTypePresets} for pre-configured values.\n *\n * ----\n * iOS\n *\n * * defaultOutput - The default preferred output to use when a wired headset or bluetooth output is unavailable.\n *\n * By default, this is set to `\"speaker\"`\n */\nexport type AudioConfiguration = {\n android?: {\n preferredOutputList?: ('speaker' | 'earpiece' | 'headset' | 'bluetooth')[];\n audioTypeOptions: AndroidAudioTypeOptions;\n };\n ios?: {\n defaultOutput?: 'speaker' | 'earpiece';\n };\n};\n\nexport type AndroidAudioTypeOptions = {\n /**\n * Whether LiveKit should handle managing the audio focus or not.\n *\n * Defaults to true.\n */\n manageAudioFocus?: boolean;\n\n /**\n * Corresponds to {@link https://developer.android.com/reference/android/media/AudioManager#setMode(int)}\n *\n * Defaults to 'inCommunication'.\n */\n audioMode?:\n | 'normal'\n | 'callScreening'\n | 'inCall'\n | 'inCommunication'\n | 'ringtone';\n\n /**\n * Corresponds to the duration hint when requesting audio focus.\n *\n * Defaults to 'gain'.\n *\n * See also {@link https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN}\n */\n audioFocusMode?:\n | 'gain'\n | 'gainTransient'\n | 'gainTransientExclusive'\n | 'gainTransientMayDuck';\n\n /**\n * Corresponds to Android's AudioAttributes usage type.\n *\n * Defaults to 'voiceCommunication'.\n *\n * See also {@link https://developer.android.com/reference/android/media/AudioAttributes}\n */\n audioAttributesUsageType?:\n | 'alarm'\n | 'assistanceAccessibility'\n | 'assistanceNavigationGuidance'\n | 'assistanceSonification'\n | 'assistant'\n | 'game'\n | 'media'\n | 'notification'\n | 'notificationEvent'\n | 'notificationRingtone'\n | 'unknown'\n | 'voiceCommunication'\n | 'voiceCommunicationSignalling';\n\n /**\n * Corresponds to Android's AndroidAttributes content type.\n *\n * Defaults to 'speech'.\n *\n * See also {@link https://developer.android.com/reference/android/media/AudioAttributes}\n */\n audioAttributesContentType?:\n | 'movie'\n | 'music'\n | 'sonification'\n | 'speech'\n | 'unknown';\n\n /**\n * Corresponds to the stream type when requesting audio focus. Used on pre-O devices.\n *\n * Defaults to 'voiceCall'\n *\n * See also {@link https://developer.android.com/reference/android/media/AudioManager#STREAM_VOICE_CALL}\n */\n audioStreamType?:\n | 'accessibility'\n | 'alarm'\n | 'dtmf'\n | 'music'\n | 'notification'\n | 'ring'\n | 'system'\n | 'voiceCall';\n\n /**\n * On certain Android devices, audio routing does not function properly and\n * bluetooth microphones will not work unless audio mode is set to\n * `inCommunication` or `inCall`. Audio routing is turned off those cases.\n *\n * If this set to true, will attempt to do audio routing regardless of audio mode.\n *\n * Defaults to false.\n */\n forceHandleAudioRouting?: boolean;\n};\n\nexport const AndroidAudioTypePresets: {\n /**\n * A pre-configured AndroidAudioConfiguration for voice communication.\n */\n communication: AndroidAudioTypeOptions;\n /**\n * A pre-configured AndroidAudioConfiguration for media playback.\n */\n media: AndroidAudioTypeOptions;\n} = {\n communication: {\n manageAudioFocus: true,\n audioMode: 'inCommunication',\n audioFocusMode: 'gain',\n audioStreamType: 'voiceCall',\n audioAttributesUsageType: 'voiceCommunication',\n audioAttributesContentType: 'speech',\n },\n media: {\n manageAudioFocus: true,\n audioMode: 'normal',\n audioFocusMode: 'gain',\n audioStreamType: 'music',\n audioAttributesUsageType: 'media',\n audioAttributesContentType: 'unknown',\n },\n} as const;\n\nexport type AppleAudioMode =\n | 'default'\n | 'gameChat'\n | 'measurement'\n | 'moviePlayback'\n | 'spokenAudio'\n | 'videoChat'\n | 'videoRecording'\n | 'voiceChat'\n | 'voicePrompt';\n\nexport type AppleAudioCategory =\n | 'soloAmbient'\n | 'playback'\n | 'record'\n | 'playAndRecord'\n | 'multiRoute';\n\nexport type AppleAudioCategoryOption =\n | 'mixWithOthers'\n | 'duckOthers'\n | 'interruptSpokenAudioAndMixWithOthers'\n | 'allowBluetooth'\n | 'allowBluetoothA2DP'\n | 'allowAirPlay'\n | 'defaultToSpeaker';\n\nexport type AppleAudioConfiguration = {\n audioCategory?: AppleAudioCategory;\n audioCategoryOptions?: AppleAudioCategoryOption[];\n audioMode?: AppleAudioMode;\n};\n\nexport type AudioTrackState =\n | 'none'\n | 'remoteOnly'\n | 'localOnly'\n | 'localAndRemote';\n\nexport function getDefaultAppleAudioConfigurationForMode(\n mode: AudioTrackState,\n preferSpeakerOutput: boolean = true\n): AppleAudioConfiguration {\n if (mode === 'remoteOnly') {\n return {\n audioCategory: 'playback',\n audioCategoryOptions: ['mixWithOthers'],\n audioMode: 'spokenAudio',\n };\n } else if (mode === 'localAndRemote' || mode === 'localOnly') {\n return {\n audioCategory: 'playAndRecord',\n audioCategoryOptions: ['allowBluetooth', 'mixWithOthers'],\n audioMode: preferSpeakerOutput ? 'videoChat' : 'voiceChat',\n };\n }\n\n return {\n audioCategory: 'soloAmbient',\n audioCategoryOptions: [],\n audioMode: 'default',\n };\n}\n\nexport default class AudioSession {\n /**\n * Applies the provided audio configuration to the underlying AudioSession.\n *\n * Must be called prior to connecting to a Room for the configuration to apply correctly.\n *\n * See also useIOSAudioManagement for automatic configuration of iOS audio options.\n */\n static configureAudio = async (config: AudioConfiguration) => {\n await LiveKitModule.configureAudio(config);\n };\n\n /**\n * Starts an AudioSession.\n */\n static startAudioSession = async () => {\n await LiveKitModule.startAudioSession();\n };\n\n /**\n * Stops the existing AudioSession.\n */\n static stopAudioSession = async () => {\n await LiveKitModule.stopAudioSession();\n };\n\n /**\n * Set default audio track volume when new tracks are subscribed.\n * Does **not** affect any existing tracks.\n *\n * @param volume A number between 0.0 and 1.0, where 0.0 represents 0% volume and\n * 1.0 represents full volume.\n */\n static setDefaultRemoteAudioTrackVolume = async (volume: number) => {\n await LiveKitModule.setDefaultAudioTrackVolume(volume);\n };\n\n /**\n * Gets the available audio outputs for use with {@link selectAudioOutput}.\n *\n * {@link startAudioSession} must be called prior to using this method.\n *\n * For Android, will return if available:\n * * \"speaker\"\n * * \"earpiece\"\n * * \"headset\"\n * * \"bluetooth\"\n *\n * ----\n *\n * For iOS, due to OS limitations, the only available types are:\n * * \"default\" - Use default iOS audio routing\n * * \"force_speaker\" - Force audio output through speaker\n *\n * See also {@link showAudioRoutePicker} to display a route picker that\n * can choose between other audio devices (i.e. headset/bluetooth/airplay),\n * or use a library like `react-native-avroutepicker` for a native platform\n * control.\n *\n * @returns the available audio output types\n */\n static getAudioOutputs = async (): Promise<string[]> => {\n if (Platform.OS === 'ios') {\n return ['default', 'force_speaker'];\n } else if (Platform.OS === 'android') {\n return (await LiveKitModule.getAudioOutputs()) as string[];\n } else {\n return [];\n }\n };\n\n /**\n * Select the provided audio output if available.\n *\n * {@link startAudioSession} must be called prior to using this method.\n *\n * @param deviceId A deviceId retrieved from {@link getAudioOutputs}\n */\n static selectAudioOutput = async (deviceId: string) => {\n await LiveKitModule.selectAudioOutput(deviceId);\n };\n\n /**\n * iOS only, requires iOS 11+.\n *\n * Displays an AVRoutePickerView for the user to choose their audio output.\n */\n static showAudioRoutePicker = async () => {\n if (Platform.OS === 'ios') {\n await LiveKitModule.showAudioRoutePicker();\n }\n };\n\n /**\n * Directly change the AVAudioSession category/mode.\n *\n * @param config The configuration to use. Null values will be omitted and the\n * existing values will be unchanged.\n */\n static setAppleAudioConfiguration = async (\n config: AppleAudioConfiguration\n ) => {\n if (Platform.OS === 'ios') {\n await LiveKitModule.setAppleAudioConfiguration(config);\n }\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA8C,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAA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QAAgB,IAAK;EACrD,MAAMT,uBAAa,CAACU,iBAAiB,CAACD,QAAQ,CAAC;AACjD,CAAC;AAED;AACF;AACA;AACA;AACA;AAJE5C,eAAA,CAlFmBiC,YAAY,0BAuFD,YAAY;EACxC,IAAIQ,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,MAAMP,uBAAa,CAACW,oBAAoB,CAAC,CAAC;EAC5C;AACF,CAAC;AAED;AACF;AACA;AACA;AACA;AACA;AALE9C,eAAA,CA7FmBiC,YAAY,gCAmGK,MAClCC,MAA+B,IAC5B;EACH,IAAIO,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,MAAMP,uBAAa,CAACY,0BAA0B,CAACb,MAAM,CAAC;EACxD;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_LKNativeModule","_interopRequireDefault","e","__esModule","default","AndroidAudioTypePresets","exports","communication","manageAudioFocus","audioMode","audioFocusMode","audioStreamType","audioAttributesUsageType","audioAttributesContentType","media","getDefaultAppleAudioConfigurationForMode","mode","preferSpeakerOutput","audioCategory","audioCategoryOptions","AudioSession","configureAudio","config","LiveKitModule","startAudioSession","stopAudioSession","setDefaultRemoteAudioTrackVolume","volume","setDefaultAudioTrackVolume","getAudioOutputs","Platform","OS","selectAudioOutput","deviceId","showAudioRoutePicker","setAppleAudioConfiguration"],"sourceRoot":"../../../src","sources":["audio/AudioSession.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA8C,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6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AAM,CAAC;IACxD;EACF,CAAC;AACH;AAAChB,OAAA,CAAAF,OAAA,GAAAgB,YAAA","ignoreList":[]}
|
|
@@ -4,15 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MediaRecorder = void 0;
|
|
7
|
+
var _reactNativeWebrtc = require("@livekit/react-native-webrtc");
|
|
7
8
|
var _EventEmitter = require("../events/EventEmitter");
|
|
8
|
-
var _index = require("event-target-shim/index");
|
|
9
9
|
var _base64Js = require("base64-js");
|
|
10
10
|
var _LKNativeModule = _interopRequireDefault(require("../LKNativeModule"));
|
|
11
11
|
var _logger = require("../logger");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
13
|
// typeof MediaRecorder
|
|
17
14
|
// const Tester = (stream: MediaStream) => {
|
|
18
15
|
// return new AudioRecorder(stream) satisfies MediaRecorder;
|
|
@@ -23,19 +20,16 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
23
20
|
*
|
|
24
21
|
* @private
|
|
25
22
|
*/
|
|
26
|
-
class MediaRecorder extends
|
|
23
|
+
class MediaRecorder extends _reactNativeWebrtc.EventTarget {
|
|
24
|
+
mimeType = 'audio/pcm';
|
|
25
|
+
audioBitsPerSecond = 0; // TODO?
|
|
26
|
+
state = 'inactive';
|
|
27
|
+
videoBitsPerSecond = 0; // TODO?
|
|
28
|
+
audioBitrateMode = 'constant';
|
|
29
|
+
_reactTag = undefined;
|
|
30
|
+
_parts = [];
|
|
27
31
|
constructor(stream) {
|
|
28
32
|
super();
|
|
29
|
-
_defineProperty(this, "mimeType", 'audio/pcm');
|
|
30
|
-
_defineProperty(this, "audioBitsPerSecond", 0);
|
|
31
|
-
// TODO?
|
|
32
|
-
_defineProperty(this, "state", 'inactive');
|
|
33
|
-
_defineProperty(this, "stream", void 0);
|
|
34
|
-
_defineProperty(this, "videoBitsPerSecond", 0);
|
|
35
|
-
// TODO?
|
|
36
|
-
_defineProperty(this, "audioBitrateMode", 'constant');
|
|
37
|
-
_defineProperty(this, "_reactTag", undefined);
|
|
38
|
-
_defineProperty(this, "_parts", []);
|
|
39
33
|
this.stream = stream;
|
|
40
34
|
}
|
|
41
35
|
registerListener() {
|
|
@@ -45,7 +39,7 @@ class MediaRecorder extends _index.EventTarget {
|
|
|
45
39
|
}
|
|
46
40
|
const mediaStreamTrack = audioTracks[0];
|
|
47
41
|
const peerConnectionId = mediaStreamTrack._peerConnectionId ?? -1;
|
|
48
|
-
const mediaStreamTrackId = mediaStreamTrack
|
|
42
|
+
const mediaStreamTrackId = mediaStreamTrack?.id;
|
|
49
43
|
this._reactTag = _LKNativeModule.default.createAudioSinkListener(peerConnectionId, mediaStreamTrackId);
|
|
50
44
|
(0, _EventEmitter.addListener)(this, 'LK_AUDIO_DATA', event => {
|
|
51
45
|
if (this._reactTag && event.id === this._reactTag && this.state === 'recording') {
|
|
@@ -63,29 +57,29 @@ class MediaRecorder extends _index.EventTarget {
|
|
|
63
57
|
}
|
|
64
58
|
const mediaStreamTrack = audioTracks[0];
|
|
65
59
|
const peerConnectionId = mediaStreamTrack._peerConnectionId ?? -1;
|
|
66
|
-
const mediaStreamTrackId = mediaStreamTrack
|
|
60
|
+
const mediaStreamTrackId = mediaStreamTrack?.id;
|
|
67
61
|
_LKNativeModule.default.deleteAudioSinkListener(this._reactTag, peerConnectionId, mediaStreamTrackId);
|
|
68
62
|
}
|
|
69
63
|
}
|
|
70
64
|
pause() {
|
|
71
65
|
this.state = 'paused';
|
|
72
|
-
this.dispatchEvent(new
|
|
66
|
+
this.dispatchEvent(new _reactNativeWebrtc.Event('pause'));
|
|
73
67
|
}
|
|
74
68
|
resume() {
|
|
75
69
|
this.state = 'recording';
|
|
76
|
-
this.dispatchEvent(new
|
|
70
|
+
this.dispatchEvent(new _reactNativeWebrtc.Event('resume'));
|
|
77
71
|
}
|
|
78
72
|
start() {
|
|
79
73
|
this.registerListener();
|
|
80
74
|
this.state = 'recording';
|
|
81
|
-
this.dispatchEvent(new
|
|
75
|
+
this.dispatchEvent(new _reactNativeWebrtc.Event('start'));
|
|
82
76
|
}
|
|
83
77
|
stop() {
|
|
84
78
|
// dispatch data must come before stopping.
|
|
85
79
|
this.dispatchData();
|
|
86
80
|
this.unregisterListener();
|
|
87
81
|
this.state = 'inactive';
|
|
88
|
-
this.dispatchEvent(new
|
|
82
|
+
this.dispatchEvent(new _reactNativeWebrtc.Event('stop'));
|
|
89
83
|
}
|
|
90
84
|
requestData() {
|
|
91
85
|
this.dispatchData();
|
|
@@ -100,6 +94,42 @@ class MediaRecorder extends _index.EventTarget {
|
|
|
100
94
|
}
|
|
101
95
|
}));
|
|
102
96
|
}
|
|
97
|
+
get ondataavailable() {
|
|
98
|
+
return (0, _reactNativeWebrtc.getEventAttributeValue)(this, 'dataavailable');
|
|
99
|
+
}
|
|
100
|
+
set ondataavailable(value) {
|
|
101
|
+
(0, _reactNativeWebrtc.setEventAttributeValue)(this, 'dataavailable', value);
|
|
102
|
+
}
|
|
103
|
+
get onerror() {
|
|
104
|
+
return (0, _reactNativeWebrtc.getEventAttributeValue)(this, 'error');
|
|
105
|
+
}
|
|
106
|
+
set onerror(value) {
|
|
107
|
+
(0, _reactNativeWebrtc.setEventAttributeValue)(this, 'error', value);
|
|
108
|
+
}
|
|
109
|
+
get onpause() {
|
|
110
|
+
return (0, _reactNativeWebrtc.getEventAttributeValue)(this, 'pause');
|
|
111
|
+
}
|
|
112
|
+
set onpause(value) {
|
|
113
|
+
(0, _reactNativeWebrtc.setEventAttributeValue)(this, 'pause', value);
|
|
114
|
+
}
|
|
115
|
+
get onresume() {
|
|
116
|
+
return (0, _reactNativeWebrtc.getEventAttributeValue)(this, 'resume');
|
|
117
|
+
}
|
|
118
|
+
set onresume(value) {
|
|
119
|
+
(0, _reactNativeWebrtc.setEventAttributeValue)(this, 'resume', value);
|
|
120
|
+
}
|
|
121
|
+
get onstart() {
|
|
122
|
+
return (0, _reactNativeWebrtc.getEventAttributeValue)(this, 'start');
|
|
123
|
+
}
|
|
124
|
+
set onstart(value) {
|
|
125
|
+
(0, _reactNativeWebrtc.setEventAttributeValue)(this, 'start', value);
|
|
126
|
+
}
|
|
127
|
+
get onstop() {
|
|
128
|
+
return (0, _reactNativeWebrtc.getEventAttributeValue)(this, 'stop');
|
|
129
|
+
}
|
|
130
|
+
set onstop(value) {
|
|
131
|
+
(0, _reactNativeWebrtc.setEventAttributeValue)(this, 'stop', value);
|
|
132
|
+
}
|
|
103
133
|
}
|
|
104
134
|
|
|
105
135
|
/**
|
|
@@ -110,23 +140,12 @@ class MediaRecorder extends _index.EventTarget {
|
|
|
110
140
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/track_event MDN} for details.
|
|
111
141
|
*/
|
|
112
142
|
exports.MediaRecorder = MediaRecorder;
|
|
113
|
-
class BlobEvent extends
|
|
143
|
+
class BlobEvent extends _reactNativeWebrtc.Event {
|
|
144
|
+
/** @eventProperty */
|
|
145
|
+
|
|
114
146
|
constructor(type, eventInitDict) {
|
|
115
147
|
super(type, eventInitDict);
|
|
116
|
-
/** @eventProperty */
|
|
117
|
-
_defineProperty(this, "data", void 0);
|
|
118
148
|
this.data = eventInitDict.data;
|
|
119
149
|
}
|
|
120
150
|
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Define the `onxxx` event handlers.
|
|
124
|
-
*/
|
|
125
|
-
const proto = MediaRecorder.prototype;
|
|
126
|
-
(0, _index.defineEventAttribute)(proto, 'dataavailable');
|
|
127
|
-
(0, _index.defineEventAttribute)(proto, 'error');
|
|
128
|
-
(0, _index.defineEventAttribute)(proto, 'pause');
|
|
129
|
-
(0, _index.defineEventAttribute)(proto, 'resume');
|
|
130
|
-
(0, _index.defineEventAttribute)(proto, 'start');
|
|
131
|
-
(0, _index.defineEventAttribute)(proto, 'stop');
|
|
132
151
|
//# sourceMappingURL=MediaRecorder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_reactNativeWebrtc","require","_EventEmitter","_base64Js","_LKNativeModule","_interopRequireDefault","_logger","e","__esModule","default","MediaRecorder","EventTarget","mimeType","audioBitsPerSecond","state","videoBitsPerSecond","audioBitrateMode","_reactTag","undefined","_parts","constructor","stream","registerListener","audioTracks","getAudioTracks","length","mediaStreamTrack","peerConnectionId","_peerConnectionId","mediaStreamTrackId","id","LiveKitModule","createAudioSinkListener","addListener","event","str","data","push","unregisterListener","log","error","deleteAudioSinkListener","pause","dispatchEvent","Event","resume","start","stop","dispatchData","requestData","combinedStr","reduce","sum","cur","toByteArray","BlobEvent","byteArray","ondataavailable","getEventAttributeValue","value","setEventAttributeValue","onerror","onpause","onresume","onstart","onstop","exports","type","eventInitDict"],"sourceRoot":"../../../src","sources":["audio/MediaRecorder.ts"],"mappings":";;;;;;AACA,IAAAA,kBAAA,GAAAC,OAAA;AAMA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAAgC,SAAAI,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC;AACA;AACA;AACA;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