@node-webrtc-rust/bindings 0.7.0 → 0.7.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 (3) hide show
  1. package/index.d.ts +27 -0
  2. package/index.js +3 -1
  3. package/package.json +7 -7
package/index.d.ts CHANGED
@@ -107,6 +107,19 @@ export interface JsRtcDataChannelInit {
107
107
  export interface JsRtcRtpTransceiverInit {
108
108
  direction?: string
109
109
  }
110
+ /** Export format for {@link JsSessionRecorder.finalize}. */
111
+ export const enum JsSessionAudioFormat {
112
+ Wav = 'Wav',
113
+ Opus = 'Opus'
114
+ }
115
+ /** Finalized session audio payload (WAV PCM or Opus-in-Ogg). */
116
+ export interface JsSessionFinalizeResult {
117
+ format: JsSessionAudioFormat
118
+ data: Buffer
119
+ durationMs: number
120
+ outboundFrames: number
121
+ inboundFrames: number
122
+ }
110
123
  export const enum JsEventDeliveryMode {
111
124
  Callback = 'callback',
112
125
  Stream = 'stream',
@@ -363,6 +376,20 @@ export declare class JsRtpTransceiver {
363
376
  setDirection(direction: string): Promise<void>
364
377
  stop(): Promise<void>
365
378
  }
379
+ /** Vendor-agnostic stereo session recorder (L=outbound, R=inbound @ 48 kHz). */
380
+ export declare class JsSessionRecorder {
381
+ /** Creates a recorder. `maxDurationMs` defaults to 90_000 (90 s cap). */
382
+ constructor(maxDurationMs?: number | undefined | null)
383
+ get isClosed(): boolean
384
+ /** Push client outbound PCM (mic / TTS). Accepts mono or stereo s16le @ 48 kHz. */
385
+ pushOutbound(pcm: Buffer): void
386
+ /** Push agent inbound PCM (ready TTS + echo). Accepts mono or stereo s16le @ 48 kHz. */
387
+ pushInbound(pcm: Buffer): void
388
+ /** Build stereo WAV bytes without closing the recorder. */
389
+ buildWav(): Buffer
390
+ /** Finalize capture. Default format is WAV; pass `Opus` for Ogg/Opus @ 256 kbps. */
391
+ finalize(format?: JsSessionAudioFormat | undefined | null): JsSessionFinalizeResult
392
+ }
366
393
  /** Voice agent with VAD, STT/TTS orchestration for one peer connection session. */
367
394
  export declare class JsVoiceAgent {
368
395
  constructor(config?: JsVoiceAgentConfig | undefined | null)
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { JsConferenceRoom, JsConferenceServer, JsMuteScope, JsRtcDataChannel, JsMediaStreamTrack, JsMediaStream, JsLocalAudioTrack, JsPeerConnection, JsRtpReceiver, JsRtpSender, JsRtpTransceiver, JsEventDeliveryMode, JsVadSampleRate, JsSttVendor, JsTtsVendor, JsSpeechEventType, JsVoiceAgent, version } = nativeBinding
313
+ const { JsConferenceRoom, JsConferenceServer, JsMuteScope, JsRtcDataChannel, JsMediaStreamTrack, JsMediaStream, JsLocalAudioTrack, JsPeerConnection, JsRtpReceiver, JsRtpSender, JsRtpTransceiver, JsSessionAudioFormat, JsSessionRecorder, JsEventDeliveryMode, JsVadSampleRate, JsSttVendor, JsTtsVendor, JsSpeechEventType, JsVoiceAgent, version } = nativeBinding
314
314
 
315
315
  module.exports.JsConferenceRoom = JsConferenceRoom
316
316
  module.exports.JsConferenceServer = JsConferenceServer
@@ -323,6 +323,8 @@ module.exports.JsPeerConnection = JsPeerConnection
323
323
  module.exports.JsRtpReceiver = JsRtpReceiver
324
324
  module.exports.JsRtpSender = JsRtpSender
325
325
  module.exports.JsRtpTransceiver = JsRtpTransceiver
326
+ module.exports.JsSessionAudioFormat = JsSessionAudioFormat
327
+ module.exports.JsSessionRecorder = JsSessionRecorder
326
328
  module.exports.JsEventDeliveryMode = JsEventDeliveryMode
327
329
  module.exports.JsVadSampleRate = JsVadSampleRate
328
330
  module.exports.JsSttVendor = JsSttVendor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-webrtc-rust/bindings",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "NAPI-RS native bindings for node-webrtc-rust — WebRTC peer connections, data channels, and conference audio mixing",
5
5
  "keywords": [
6
6
  "webrtc",
@@ -58,12 +58,12 @@
58
58
  "@napi-rs/cli": "^2.18.0"
59
59
  },
60
60
  "optionalDependencies": {
61
- "@node-webrtc-rust/bindings-win32-x64-msvc": "0.7.0",
62
- "@node-webrtc-rust/bindings-darwin-x64": "0.7.0",
63
- "@node-webrtc-rust/bindings-linux-x64-gnu": "0.7.0",
64
- "@node-webrtc-rust/bindings-darwin-arm64": "0.7.0",
65
- "@node-webrtc-rust/bindings-linux-arm64-gnu": "0.7.0",
66
- "@node-webrtc-rust/bindings-linux-x64-musl": "0.7.0"
61
+ "@node-webrtc-rust/bindings-win32-x64-msvc": "0.7.1",
62
+ "@node-webrtc-rust/bindings-darwin-x64": "0.7.1",
63
+ "@node-webrtc-rust/bindings-linux-x64-gnu": "0.7.1",
64
+ "@node-webrtc-rust/bindings-darwin-arm64": "0.7.1",
65
+ "@node-webrtc-rust/bindings-linux-arm64-gnu": "0.7.1",
66
+ "@node-webrtc-rust/bindings-linux-x64-musl": "0.7.1"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=18"