@node-webrtc-rust/bindings 0.8.1 → 0.9.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 +39 -0
  2. package/index.js +9 -1
  3. package/package.json +7 -7
package/index.d.ts CHANGED
@@ -147,6 +147,27 @@ export interface JsDistanceParams {
147
147
  maxDistance: number
148
148
  rolloff: number
149
149
  }
150
+ export const enum JsClipStatus {
151
+ Buffering = 'Buffering',
152
+ Playing = 'Playing',
153
+ Stopped = 'Stopped',
154
+ Ended = 'Ended',
155
+ Error = 'Error'
156
+ }
157
+ export interface JsClipPlayerStatus {
158
+ playId: string
159
+ status: JsClipStatus
160
+ positionMs: number
161
+ durationMs?: number
162
+ bufferedMs: number
163
+ error?: string
164
+ }
165
+ export declare function playClipFromPath(path: string): string
166
+ export declare function playClipFromBytes(data: Buffer): string
167
+ export declare function playClipProgressive(): JsGrowingClipWriter
168
+ export declare function getClipStatus(playId: string): JsClipPlayerStatus | null
169
+ export declare function stopClip(playId: string): boolean
170
+ export declare function takeClipFrame(playId: string): Buffer | null
150
171
  /** Init options for {@link RTCPeerConnection.addTransceiver}. */
151
172
  export interface JsRtcRtpTransceiverInit {
152
173
  direction?: string
@@ -248,11 +269,18 @@ export interface JsVoiceSessionContext {
248
269
  buildId?: string
249
270
  traceparent?: string
250
271
  }
272
+ export interface JsLanguageIdConfig {
273
+ enabled?: boolean
274
+ modelPath?: string
275
+ allowlist?: Array<string>
276
+ minSpeechMs?: number
277
+ }
251
278
  export interface JsVoiceAgentConfig {
252
279
  vad?: JsVadConfig
253
280
  events?: JsEventsConfig
254
281
  stt?: JsSttConfig
255
282
  tts?: JsTtsConfig
283
+ languageId?: JsLanguageIdConfig
256
284
  postUtteranceSilenceMs?: number
257
285
  noiseSuppression?: JsNoiseSuppressionConfig
258
286
  }
@@ -261,6 +289,7 @@ export const enum JsSpeechEventType {
261
289
  UserSpeakingEnd = 'user_speaking_end',
262
290
  UserSpeechPartial = 'user_speech_partial',
263
291
  UserSpeechFinal = 'user_speech_final',
292
+ UserLanguage = 'user_language',
264
293
  AgentSpeakingStart = 'agent_speaking_start',
265
294
  AgentSpeakingEnd = 'agent_speaking_end',
266
295
  VadTriggered = 'vad_triggered',
@@ -275,6 +304,7 @@ export const enum JsSpeechEventType {
275
304
  export interface JsSpeechEvent {
276
305
  eventType: JsSpeechEventType
277
306
  text?: string
307
+ language?: string
278
308
  error?: string
279
309
  }
280
310
  export declare function version(): string
@@ -392,6 +422,9 @@ export declare class JsMixGraph {
392
422
  defaultMixPlacement(): JsMixPlacement
393
423
  setTtsMixPlacement(placement: JsMixPlacement): void
394
424
  ttsMixPlacement(): JsMixPlacement
425
+ setSourceMixPlacement(participantId: string, placement: JsMixPlacement): void
426
+ clearSourceMixPlacement(participantId: string): void
427
+ sourceMixPlacement(participantId: string): JsMixPlacement | null
395
428
  setTtsPose(participantId: string, pose: JsClientPose): void
396
429
  clearTtsPose(participantId: string): void
397
430
  ttsPose(participantId: string): JsClientPose | null
@@ -443,6 +476,12 @@ export declare class JsPeerConnection {
443
476
  setOnSignalingStateChange(callback: (...args: any[]) => any): void
444
477
  setOnNegotiationNeeded(callback: (...args: any[]) => any): void
445
478
  }
479
+ export declare class JsGrowingClipWriter {
480
+ get playId(): string
481
+ append(chunk: Buffer): void
482
+ markEof(): void
483
+ isEof(): boolean
484
+ }
446
485
  /** RTP receiver leg of an {@link RTCRtpTransceiver}. */
447
486
  export declare class JsRtpReceiver {
448
487
  get id(): string
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, JsMixGraph, JsMixPlacement, JsRoomNoiseSuppression, JsMuteScope, JsRtcDataChannel, JsMediaStreamTrack, JsMediaStream, JsLocalAudioTrack, JsPeerConnection, JsRtpReceiver, JsRtpSender, JsRtpTransceiver, JsSessionAudioFormat, JsSessionRecorder, JsEventDeliveryMode, JsNoiseSuppressionProvider, JsVadSampleRate, JsSttVendor, JsTtsVendor, JsSpeechEventType, JsVoiceAgent, jsQuatIdentity, jsVec3Zero, version } = nativeBinding
313
+ const { JsConferenceRoom, JsConferenceServer, JsMixGraph, JsMixPlacement, JsRoomNoiseSuppression, JsMuteScope, JsRtcDataChannel, JsMediaStreamTrack, JsMediaStream, JsLocalAudioTrack, JsPeerConnection, JsRtpReceiver, JsRtpSender, JsRtpTransceiver, JsSessionAudioFormat, JsSessionRecorder, JsEventDeliveryMode, JsNoiseSuppressionProvider, JsVadSampleRate, JsSttVendor, JsTtsVendor, JsSpeechEventType, JsVoiceAgent, JsClipStatus, JsGrowingClipWriter, playClipFromPath, playClipFromBytes, playClipProgressive, getClipStatus, stopClip, takeClipFrame, jsQuatIdentity, jsVec3Zero, version } = nativeBinding
314
314
 
315
315
  module.exports.JsConferenceRoom = JsConferenceRoom
316
316
  module.exports.JsConferenceServer = JsConferenceServer
@@ -335,6 +335,14 @@ module.exports.JsSttVendor = JsSttVendor
335
335
  module.exports.JsTtsVendor = JsTtsVendor
336
336
  module.exports.JsSpeechEventType = JsSpeechEventType
337
337
  module.exports.JsVoiceAgent = JsVoiceAgent
338
+ module.exports.JsClipStatus = JsClipStatus
339
+ module.exports.JsGrowingClipWriter = JsGrowingClipWriter
340
+ module.exports.playClipFromPath = playClipFromPath
341
+ module.exports.playClipFromBytes = playClipFromBytes
342
+ module.exports.playClipProgressive = playClipProgressive
343
+ module.exports.getClipStatus = getClipStatus
344
+ module.exports.stopClip = stopClip
345
+ module.exports.takeClipFrame = takeClipFrame
338
346
  module.exports.jsQuatIdentity = jsQuatIdentity
339
347
  module.exports.jsVec3Zero = jsVec3Zero
340
348
  module.exports.version = version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-webrtc-rust/bindings",
3
- "version": "0.8.1",
3
+ "version": "0.9.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.8.1",
62
- "@node-webrtc-rust/bindings-darwin-x64": "0.8.1",
63
- "@node-webrtc-rust/bindings-linux-x64-gnu": "0.8.1",
64
- "@node-webrtc-rust/bindings-darwin-arm64": "0.8.1",
65
- "@node-webrtc-rust/bindings-linux-arm64-gnu": "0.8.1",
66
- "@node-webrtc-rust/bindings-linux-x64-musl": "0.8.1"
61
+ "@node-webrtc-rust/bindings-win32-x64-msvc": "0.9.1",
62
+ "@node-webrtc-rust/bindings-darwin-x64": "0.9.1",
63
+ "@node-webrtc-rust/bindings-linux-x64-gnu": "0.9.1",
64
+ "@node-webrtc-rust/bindings-darwin-arm64": "0.9.1",
65
+ "@node-webrtc-rust/bindings-linux-arm64-gnu": "0.9.1",
66
+ "@node-webrtc-rust/bindings-linux-x64-musl": "0.9.1"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=18"