@node-webrtc-rust/bindings 0.7.4 → 0.8.0
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/index.d.ts +93 -0
- package/index.js +7 -1
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ export interface JsIceServer {
|
|
|
14
14
|
export interface JsRoomOptions {
|
|
15
15
|
maxParticipants?: number
|
|
16
16
|
iceServers?: Array<JsIceServer>
|
|
17
|
+
noiseSuppression?: JsRoomNoiseSuppression
|
|
18
|
+
}
|
|
19
|
+
/** Per-participant inbound RNNoise toggle for conference mixing. */
|
|
20
|
+
export const enum JsRoomNoiseSuppression {
|
|
21
|
+
None = 'none',
|
|
22
|
+
Rnnoise = 'rnnoise'
|
|
17
23
|
}
|
|
18
24
|
/** Participant summary exposed to JavaScript. */
|
|
19
25
|
export interface JsParticipantInfo {
|
|
@@ -103,6 +109,44 @@ export interface JsRtcDataChannelInit {
|
|
|
103
109
|
protocol?: string
|
|
104
110
|
negotiated?: number
|
|
105
111
|
}
|
|
112
|
+
/** Identity quaternion helper for pose setup from TypeScript. */
|
|
113
|
+
export declare function jsQuatIdentity(): JsQuat
|
|
114
|
+
/** Origin position helper for pose setup from TypeScript. */
|
|
115
|
+
export declare function jsVec3Zero(): JsVec3
|
|
116
|
+
/** Named listener-relative placement when positional mixing is off. */
|
|
117
|
+
export const enum JsMixPlacement {
|
|
118
|
+
Center = 'center',
|
|
119
|
+
Left = 'left',
|
|
120
|
+
Right = 'right',
|
|
121
|
+
Front = 'front',
|
|
122
|
+
Behind = 'behind',
|
|
123
|
+
Below = 'below',
|
|
124
|
+
Above = 'above'
|
|
125
|
+
}
|
|
126
|
+
/** 3D vector for positional mixing. */
|
|
127
|
+
export interface JsVec3 {
|
|
128
|
+
x: number
|
|
129
|
+
y: number
|
|
130
|
+
z: number
|
|
131
|
+
}
|
|
132
|
+
/** Unit quaternion for positional mixing. */
|
|
133
|
+
export interface JsQuat {
|
|
134
|
+
x: number
|
|
135
|
+
y: number
|
|
136
|
+
z: number
|
|
137
|
+
w: number
|
|
138
|
+
}
|
|
139
|
+
/** World-space pose for a mix participant. */
|
|
140
|
+
export interface JsClientPose {
|
|
141
|
+
position: JsVec3
|
|
142
|
+
orientation: JsQuat
|
|
143
|
+
}
|
|
144
|
+
/** Distance attenuation parameters for positional panning. */
|
|
145
|
+
export interface JsDistanceParams {
|
|
146
|
+
referenceDistance: number
|
|
147
|
+
maxDistance: number
|
|
148
|
+
rolloff: number
|
|
149
|
+
}
|
|
106
150
|
/** Init options for {@link RTCPeerConnection.addTransceiver}. */
|
|
107
151
|
export interface JsRtcRtpTransceiverInit {
|
|
108
152
|
direction?: string
|
|
@@ -189,6 +233,13 @@ export interface JsTtsConfig {
|
|
|
189
233
|
apiKey?: string
|
|
190
234
|
postUtteranceSilenceMs?: number
|
|
191
235
|
}
|
|
236
|
+
export const enum JsNoiseSuppressionProvider {
|
|
237
|
+
None = 'none',
|
|
238
|
+
Rnnoise = 'rnnoise'
|
|
239
|
+
}
|
|
240
|
+
export interface JsNoiseSuppressionConfig {
|
|
241
|
+
provider?: JsNoiseSuppressionProvider
|
|
242
|
+
}
|
|
192
243
|
export interface JsVoiceSessionContext {
|
|
193
244
|
sessionId?: string
|
|
194
245
|
traceId?: string
|
|
@@ -203,6 +254,7 @@ export interface JsVoiceAgentConfig {
|
|
|
203
254
|
stt?: JsSttConfig
|
|
204
255
|
tts?: JsTtsConfig
|
|
205
256
|
postUtteranceSilenceMs?: number
|
|
257
|
+
noiseSuppression?: JsNoiseSuppressionConfig
|
|
206
258
|
}
|
|
207
259
|
export const enum JsSpeechEventType {
|
|
208
260
|
UserSpeakingStart = 'user_speaking_start',
|
|
@@ -317,6 +369,44 @@ export declare class JsLocalAudioTrack {
|
|
|
317
369
|
/** Writes interleaved stereo PCM; encoded to the negotiated RTP codec before send. */
|
|
318
370
|
writeSample(data: Buffer, durationMs: number): Promise<void>
|
|
319
371
|
}
|
|
372
|
+
/** Conference mix graph control handle (poses, groups, mutes, placements). */
|
|
373
|
+
export declare class JsMixGraph {
|
|
374
|
+
constructor()
|
|
375
|
+
addInput(participantId: string): void
|
|
376
|
+
removeInput(participantId: string): void
|
|
377
|
+
setMixingEnabled(enabled: boolean): void
|
|
378
|
+
mixingEnabled(): boolean
|
|
379
|
+
setGlobalMute(target: string, muted: boolean): void
|
|
380
|
+
isGloballyMuted(target: string): boolean
|
|
381
|
+
setListenerMute(listener: string, target: string, muted: boolean): void
|
|
382
|
+
isListenerMuted(listener: string, target: string): boolean
|
|
383
|
+
setListenerSources(listener: string, sources: Array<string>): void
|
|
384
|
+
listenerSources(listener: string): Array<string> | null
|
|
385
|
+
clearListenerRoutes(listener: string): void
|
|
386
|
+
setPose(participantId: string, pose: JsClientPose): void
|
|
387
|
+
clearPose(participantId: string): void
|
|
388
|
+
pose(participantId: string): JsClientPose | null
|
|
389
|
+
setPositionalEnabled(enabled: boolean): void
|
|
390
|
+
positionalEnabled(): boolean
|
|
391
|
+
setDefaultMixPlacement(placement: JsMixPlacement): void
|
|
392
|
+
defaultMixPlacement(): JsMixPlacement
|
|
393
|
+
setTtsMixPlacement(placement: JsMixPlacement): void
|
|
394
|
+
ttsMixPlacement(): JsMixPlacement
|
|
395
|
+
setTtsPose(participantId: string, pose: JsClientPose): void
|
|
396
|
+
clearTtsPose(participantId: string): void
|
|
397
|
+
ttsPose(participantId: string): JsClientPose | null
|
|
398
|
+
setDistanceParams(params: JsDistanceParams): void
|
|
399
|
+
distanceParams(): JsDistanceParams
|
|
400
|
+
setGroupMembers(groupId: string, members: Array<string>): void
|
|
401
|
+
moveToGroup(participantId: string, groupId: string): void
|
|
402
|
+
removeFromGroup(participantId: string): void
|
|
403
|
+
/** Stores the latest 20 ms stereo PCM frame for a participant (3840 bytes @ 48 kHz). */
|
|
404
|
+
pushFrame(participantId: string, pcm: Buffer): void
|
|
405
|
+
/** Renders mixed stereo PCM for `listener_id` (3840 bytes; silence when ungrouped or mixing off). */
|
|
406
|
+
renderOutput(listenerId: string): Buffer
|
|
407
|
+
/** Pans a TTS frame for `listener_id` using the graph's TTS pose or placement. */
|
|
408
|
+
panTtsFrame(pcm: Buffer, listenerId: string): Buffer
|
|
409
|
+
}
|
|
320
410
|
/** WebRTC peer connection exposed to JavaScript. */
|
|
321
411
|
export declare class JsPeerConnection {
|
|
322
412
|
constructor(config?: JsRtcConfiguration | undefined | null)
|
|
@@ -406,4 +496,7 @@ export declare class JsVoiceAgent {
|
|
|
406
496
|
setOnSpeechEvent(callback: (...args: any[]) => any): void
|
|
407
497
|
/** Processes one inbound PCM frame (48 kHz stereo) through VAD/STT. */
|
|
408
498
|
processInboundPcm(data: Buffer, durationMs: number): Promise<void>
|
|
499
|
+
/** When `false`, inbound PCM still runs VAD but skips STT and user speech events. */
|
|
500
|
+
setSttEnabled(enabled: boolean): Promise<void>
|
|
501
|
+
sttEnabled(): Promise<boolean>
|
|
409
502
|
}
|
package/index.js
CHANGED
|
@@ -310,10 +310,13 @@ 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, JsSessionAudioFormat, JsSessionRecorder, JsEventDeliveryMode, JsVadSampleRate, JsSttVendor, JsTtsVendor, JsSpeechEventType, JsVoiceAgent, 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, jsQuatIdentity, jsVec3Zero, version } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.JsConferenceRoom = JsConferenceRoom
|
|
316
316
|
module.exports.JsConferenceServer = JsConferenceServer
|
|
317
|
+
module.exports.JsMixGraph = JsMixGraph
|
|
318
|
+
module.exports.JsMixPlacement = JsMixPlacement
|
|
319
|
+
module.exports.JsRoomNoiseSuppression = JsRoomNoiseSuppression
|
|
317
320
|
module.exports.JsMuteScope = JsMuteScope
|
|
318
321
|
module.exports.JsRtcDataChannel = JsRtcDataChannel
|
|
319
322
|
module.exports.JsMediaStreamTrack = JsMediaStreamTrack
|
|
@@ -326,9 +329,12 @@ module.exports.JsRtpTransceiver = JsRtpTransceiver
|
|
|
326
329
|
module.exports.JsSessionAudioFormat = JsSessionAudioFormat
|
|
327
330
|
module.exports.JsSessionRecorder = JsSessionRecorder
|
|
328
331
|
module.exports.JsEventDeliveryMode = JsEventDeliveryMode
|
|
332
|
+
module.exports.JsNoiseSuppressionProvider = JsNoiseSuppressionProvider
|
|
329
333
|
module.exports.JsVadSampleRate = JsVadSampleRate
|
|
330
334
|
module.exports.JsSttVendor = JsSttVendor
|
|
331
335
|
module.exports.JsTtsVendor = JsTtsVendor
|
|
332
336
|
module.exports.JsSpeechEventType = JsSpeechEventType
|
|
333
337
|
module.exports.JsVoiceAgent = JsVoiceAgent
|
|
338
|
+
module.exports.jsQuatIdentity = jsQuatIdentity
|
|
339
|
+
module.exports.jsVec3Zero = jsVec3Zero
|
|
334
340
|
module.exports.version = version
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-webrtc-rust/bindings",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
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.
|
|
62
|
-
"@node-webrtc-rust/bindings-darwin-x64": "0.
|
|
63
|
-
"@node-webrtc-rust/bindings-linux-x64-gnu": "0.
|
|
64
|
-
"@node-webrtc-rust/bindings-darwin-arm64": "0.
|
|
65
|
-
"@node-webrtc-rust/bindings-linux-arm64-gnu": "0.
|
|
66
|
-
"@node-webrtc-rust/bindings-linux-x64-musl": "0.
|
|
61
|
+
"@node-webrtc-rust/bindings-win32-x64-msvc": "0.8.0",
|
|
62
|
+
"@node-webrtc-rust/bindings-darwin-x64": "0.8.0",
|
|
63
|
+
"@node-webrtc-rust/bindings-linux-x64-gnu": "0.8.0",
|
|
64
|
+
"@node-webrtc-rust/bindings-darwin-arm64": "0.8.0",
|
|
65
|
+
"@node-webrtc-rust/bindings-linux-arm64-gnu": "0.8.0",
|
|
66
|
+
"@node-webrtc-rust/bindings-linux-x64-musl": "0.8.0"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=18"
|