voice-router-dev 0.3.4 → 0.3.5

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.mjs CHANGED
@@ -2198,28 +2198,36 @@ var GladiaAdapter = class extends BaseAdapter {
2198
2198
  * Gladia stores the audio files used for transcription and allows downloading them.
2199
2199
  * This works for both pre-recorded and streaming (live) transcriptions.
2200
2200
  *
2201
+ * Returns ArrayBuffer for cross-platform compatibility (Node.js and browser).
2202
+ *
2201
2203
  * @param transcriptId - The ID of the transcript/job
2202
2204
  * @param jobType - Type of job: 'pre-recorded' or 'streaming' (defaults to 'pre-recorded')
2203
- * @returns Promise with the audio file as a Blob, or error
2205
+ * @returns Promise with the audio file as ArrayBuffer, or error
2204
2206
  *
2205
- * @example Download audio from a pre-recorded transcription
2207
+ * @example Download and save audio (Node.js)
2206
2208
  * ```typescript
2207
2209
  * const result = await adapter.getAudioFile('abc123');
2208
2210
  * if (result.success && result.data) {
2209
- * // Save to file (Node.js)
2210
- * const buffer = Buffer.from(await result.data.arrayBuffer());
2211
+ * const buffer = Buffer.from(result.data);
2211
2212
  * fs.writeFileSync('audio.mp3', buffer);
2213
+ * }
2214
+ * ```
2212
2215
  *
2213
- * // Or create download URL (browser)
2214
- * const url = URL.createObjectURL(result.data);
2216
+ * @example Download and create URL (Browser)
2217
+ * ```typescript
2218
+ * const result = await adapter.getAudioFile('abc123');
2219
+ * if (result.success && result.data) {
2220
+ * const blob = new Blob([result.data], { type: 'audio/mpeg' });
2221
+ * const url = URL.createObjectURL(blob);
2222
+ * audioElement.src = url;
2215
2223
  * }
2216
2224
  * ```
2217
2225
  *
2218
2226
  * @example Download audio from a live/streaming session
2219
2227
  * ```typescript
2220
2228
  * const result = await adapter.getAudioFile('stream-456', 'streaming');
2221
- * if (result.success) {
2222
- * console.log('Audio file size:', result.data?.size);
2229
+ * if (result.success && result.data) {
2230
+ * console.log('Audio file size:', result.data.byteLength, 'bytes');
2223
2231
  * }
2224
2232
  * ```
2225
2233
  *
@@ -2228,15 +2236,20 @@ var GladiaAdapter = class extends BaseAdapter {
2228
2236
  async getAudioFile(transcriptId, jobType = "pre-recorded") {
2229
2237
  this.validateConfig();
2230
2238
  try {
2239
+ const config = {
2240
+ ...this.getAxiosConfig(),
2241
+ responseType: "arraybuffer"
2242
+ };
2231
2243
  let response;
2232
2244
  if (jobType === "streaming") {
2233
- response = await streamingControllerGetAudioV2(transcriptId, this.getAxiosConfig());
2245
+ response = await streamingControllerGetAudioV2(transcriptId, config);
2234
2246
  } else {
2235
- response = await preRecordedControllerGetAudioV2(transcriptId, this.getAxiosConfig());
2247
+ response = await preRecordedControllerGetAudioV2(transcriptId, config);
2236
2248
  }
2237
2249
  return {
2238
2250
  success: true,
2239
- data: response.data
2251
+ data: response.data,
2252
+ contentType: response.headers?.["content-type"]
2240
2253
  };
2241
2254
  } catch (error) {
2242
2255
  const err = error;