@fluxerjs/voice 1.1.7 → 1.1.9

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/dist/index.d.mts CHANGED
@@ -82,6 +82,8 @@ type LiveKitRtcConnectionEvents = VoiceConnectionEvents & {
82
82
  * @property maxFramerate - Max framerate for encoding (default: 60).
83
83
  * @property width - Output width (default: source). FFmpeg path only.
84
84
  * @property height - Output height (default: source). FFmpeg path only.
85
+ * @property resolution - Output resolution. When set, overrides width/height and maxFramerate. FFmpeg path only.
86
+ * 480p, 720p, 1080p, 1440p, 4k = @ 30fps.
85
87
  */
86
88
  interface VideoPlayOptions {
87
89
  /** Track source hint - camera or screenshare (default: camera). */
@@ -98,6 +100,8 @@ interface VideoPlayOptions {
98
100
  width?: number;
99
101
  /** Output height for resolution override (FFmpeg path). */
100
102
  height?: number;
103
+ /** Output resolution. When set, overrides width/height and maxFramerate. FFmpeg path only. */
104
+ resolution?: '480p' | '720p' | '1080p' | '1440p' | '4k';
101
105
  }
102
106
  /**
103
107
  * Voice connection using LiveKit RTC. Used when Fluxer routes voice to LiveKit.
@@ -114,6 +118,7 @@ declare class LiveKitRtcConnection extends EventEmitter {
114
118
  readonly client: Client;
115
119
  readonly channel: VoiceChannel;
116
120
  readonly guildId: string;
121
+ private _volume;
117
122
  private _playing;
118
123
  private _playingVideo;
119
124
  private _destroyed;
@@ -147,6 +152,10 @@ declare class LiveKitRtcConnection extends EventEmitter {
147
152
  * @param token - Voice server token
148
153
  */
149
154
  isSameServer(endpoint: string | null, token: string): boolean;
155
+ /** Set playback volume (0-200, 100 = normal). Affects current and future playback. */
156
+ setVolume(volumePercent: number): void;
157
+ /** Get current volume (0-200). */
158
+ getVolume(): number;
150
159
  playOpus(_stream: NodeJS.ReadableStream): void;
151
160
  /**
152
161
  * Connect to the LiveKit room using voice server and state from the gateway.
@@ -222,11 +231,13 @@ interface VoiceManagerOptions {
222
231
  /** Manages voice connections. Use `getVoiceManager(client)` to obtain an instance. */
223
232
  declare class VoiceManager extends EventEmitter {
224
233
  readonly client: Client;
234
+ /** channel_id -> connection (Fluxer multi-channel: allows multiple connections per guild) */
225
235
  private readonly connections;
226
- /** guild_id -> connection_id (from VoiceServerUpdate; required for voice state updates when in channel) */
236
+ /** channel_id -> connection_id (from VoiceServerUpdate; required for voice state updates) */
227
237
  private readonly connectionIds;
228
238
  /** guild_id -> user_id -> channel_id */
229
239
  readonly voiceStates: VoiceStateMap;
240
+ /** channel_id -> pending join */
230
241
  private readonly pending;
231
242
  private readonly shardId;
232
243
  constructor(client: Client, options?: VoiceManagerOptions);
@@ -246,29 +257,36 @@ declare class VoiceManager extends EventEmitter {
246
257
  private tryCompletePending;
247
258
  /**
248
259
  * Join a voice channel. Resolves when the connection is ready.
260
+ * Supports multiple connections per guild (Fluxer multi-channel).
249
261
  * @param channel - The voice channel to join
250
262
  * @returns The voice connection (LiveKitRtcConnection when Fluxer uses LiveKit)
251
263
  */
252
264
  join(channel: VoiceChannel): Promise<VoiceConnection | LiveKitRtcConnection>;
253
265
  /**
254
- * Leave a guild's voice channel and disconnect.
266
+ * Leave all voice channels in a guild.
267
+ * With multi-channel support, disconnects from every channel in the guild.
255
268
  * @param guildId - Guild ID to leave
256
269
  */
257
270
  leave(guildId: string): void;
258
271
  /**
259
- * Get the active voice connection for a guild, if any.
260
- * @param guildId - Guild ID to look up
272
+ * Leave a specific voice channel by channel ID.
273
+ * @param channelId - Channel ID to leave
274
+ */
275
+ leaveChannel(channelId: string): void;
276
+ /**
277
+ * Get the active voice connection for a channel or guild.
278
+ * @param channelOrGuildId - Channel ID (primary) or guild ID (returns first connection in that guild)
261
279
  */
262
- getConnection(guildId: string): VoiceConnection | LiveKitRtcConnection | undefined;
280
+ getConnection(channelOrGuildId: string): VoiceConnection | LiveKitRtcConnection | undefined;
263
281
  /**
264
282
  * Update voice state (e.g. self_stream, self_video) while in a channel.
265
283
  * Sends a VoiceStateUpdate to the gateway so the server and clients see the change.
266
284
  * Requires connection_id (from VoiceServerUpdate); without it, the gateway would treat
267
285
  * the update as a new join and trigger a new VoiceServerUpdate, causing connection loops.
268
- * @param guildId - Guild ID
286
+ * @param channelId - Channel ID (connection key)
269
287
  * @param partial - Partial voice state to update (self_stream, self_video, self_mute, self_deaf)
270
288
  */
271
- updateVoiceState(guildId: string, partial: {
289
+ updateVoiceState(channelId: string, partial: {
272
290
  self_stream?: boolean;
273
291
  self_video?: boolean;
274
292
  self_mute?: boolean;
package/dist/index.d.ts CHANGED
@@ -82,6 +82,8 @@ type LiveKitRtcConnectionEvents = VoiceConnectionEvents & {
82
82
  * @property maxFramerate - Max framerate for encoding (default: 60).
83
83
  * @property width - Output width (default: source). FFmpeg path only.
84
84
  * @property height - Output height (default: source). FFmpeg path only.
85
+ * @property resolution - Output resolution. When set, overrides width/height and maxFramerate. FFmpeg path only.
86
+ * 480p, 720p, 1080p, 1440p, 4k = @ 30fps.
85
87
  */
86
88
  interface VideoPlayOptions {
87
89
  /** Track source hint - camera or screenshare (default: camera). */
@@ -98,6 +100,8 @@ interface VideoPlayOptions {
98
100
  width?: number;
99
101
  /** Output height for resolution override (FFmpeg path). */
100
102
  height?: number;
103
+ /** Output resolution. When set, overrides width/height and maxFramerate. FFmpeg path only. */
104
+ resolution?: '480p' | '720p' | '1080p' | '1440p' | '4k';
101
105
  }
102
106
  /**
103
107
  * Voice connection using LiveKit RTC. Used when Fluxer routes voice to LiveKit.
@@ -114,6 +118,7 @@ declare class LiveKitRtcConnection extends EventEmitter {
114
118
  readonly client: Client;
115
119
  readonly channel: VoiceChannel;
116
120
  readonly guildId: string;
121
+ private _volume;
117
122
  private _playing;
118
123
  private _playingVideo;
119
124
  private _destroyed;
@@ -147,6 +152,10 @@ declare class LiveKitRtcConnection extends EventEmitter {
147
152
  * @param token - Voice server token
148
153
  */
149
154
  isSameServer(endpoint: string | null, token: string): boolean;
155
+ /** Set playback volume (0-200, 100 = normal). Affects current and future playback. */
156
+ setVolume(volumePercent: number): void;
157
+ /** Get current volume (0-200). */
158
+ getVolume(): number;
150
159
  playOpus(_stream: NodeJS.ReadableStream): void;
151
160
  /**
152
161
  * Connect to the LiveKit room using voice server and state from the gateway.
@@ -222,11 +231,13 @@ interface VoiceManagerOptions {
222
231
  /** Manages voice connections. Use `getVoiceManager(client)` to obtain an instance. */
223
232
  declare class VoiceManager extends EventEmitter {
224
233
  readonly client: Client;
234
+ /** channel_id -> connection (Fluxer multi-channel: allows multiple connections per guild) */
225
235
  private readonly connections;
226
- /** guild_id -> connection_id (from VoiceServerUpdate; required for voice state updates when in channel) */
236
+ /** channel_id -> connection_id (from VoiceServerUpdate; required for voice state updates) */
227
237
  private readonly connectionIds;
228
238
  /** guild_id -> user_id -> channel_id */
229
239
  readonly voiceStates: VoiceStateMap;
240
+ /** channel_id -> pending join */
230
241
  private readonly pending;
231
242
  private readonly shardId;
232
243
  constructor(client: Client, options?: VoiceManagerOptions);
@@ -246,29 +257,36 @@ declare class VoiceManager extends EventEmitter {
246
257
  private tryCompletePending;
247
258
  /**
248
259
  * Join a voice channel. Resolves when the connection is ready.
260
+ * Supports multiple connections per guild (Fluxer multi-channel).
249
261
  * @param channel - The voice channel to join
250
262
  * @returns The voice connection (LiveKitRtcConnection when Fluxer uses LiveKit)
251
263
  */
252
264
  join(channel: VoiceChannel): Promise<VoiceConnection | LiveKitRtcConnection>;
253
265
  /**
254
- * Leave a guild's voice channel and disconnect.
266
+ * Leave all voice channels in a guild.
267
+ * With multi-channel support, disconnects from every channel in the guild.
255
268
  * @param guildId - Guild ID to leave
256
269
  */
257
270
  leave(guildId: string): void;
258
271
  /**
259
- * Get the active voice connection for a guild, if any.
260
- * @param guildId - Guild ID to look up
272
+ * Leave a specific voice channel by channel ID.
273
+ * @param channelId - Channel ID to leave
274
+ */
275
+ leaveChannel(channelId: string): void;
276
+ /**
277
+ * Get the active voice connection for a channel or guild.
278
+ * @param channelOrGuildId - Channel ID (primary) or guild ID (returns first connection in that guild)
261
279
  */
262
- getConnection(guildId: string): VoiceConnection | LiveKitRtcConnection | undefined;
280
+ getConnection(channelOrGuildId: string): VoiceConnection | LiveKitRtcConnection | undefined;
263
281
  /**
264
282
  * Update voice state (e.g. self_stream, self_video) while in a channel.
265
283
  * Sends a VoiceStateUpdate to the gateway so the server and clients see the change.
266
284
  * Requires connection_id (from VoiceServerUpdate); without it, the gateway would treat
267
285
  * the update as a new join and trigger a new VoiceServerUpdate, causing connection loops.
268
- * @param guildId - Guild ID
286
+ * @param channelId - Channel ID (connection key)
269
287
  * @param partial - Partial voice state to update (self_stream, self_video, self_mute, self_deaf)
270
288
  */
271
- updateVoiceState(guildId: string, partial: {
289
+ updateVoiceState(channelId: string, partial: {
272
290
  self_stream?: boolean;
273
291
  self_video?: boolean;
274
292
  self_mute?: boolean;