@mux/ai 0.5.0 → 0.5.2

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.
@@ -1,3 +1,3 @@
1
- export { D as DEFAULT_STORYBOARD_WIDTH, T as ThumbnailOptions, f as TranscriptFetchOptions, h as TranscriptResult, V as VTTCue, n as buildTranscriptUrl, c as chunkByTokens, b as chunkText, a as chunkVTTCues, e as estimateTokenCount, l as extractTextFromVTT, m as extractTimestampedTranscript, o as fetchTranscriptForAsset, k as findCaptionTrack, j as getReadyTextTracks, g as getStoryboardUrl, d as getThumbnailUrls, p as parseVTTCues, s as secondsToTimestamp, v as vttTimestampToSeconds } from '../index-Dmo55n-5.js';
2
- import '../types-KcVfWtUl.js';
1
+ export { D as DEFAULT_STORYBOARD_WIDTH, T as ThumbnailOptions, f as TranscriptFetchOptions, h as TranscriptResult, V as VTTCue, n as buildTranscriptUrl, c as chunkByTokens, b as chunkText, a as chunkVTTCues, e as estimateTokenCount, l as extractTextFromVTT, m as extractTimestampedTranscript, o as fetchTranscriptForAsset, k as findCaptionTrack, j as getReadyTextTracks, g as getStoryboardUrl, d as getThumbnailUrls, p as parseVTTCues, s as secondsToTimestamp, v as vttTimestampToSeconds } from '../index-2oUwgWsE.js';
2
+ import '../types-BhVuLeSp.js';
3
3
  import '@mux/mux-node';
@@ -28425,8 +28425,8 @@ function chunkText(text, strategy) {
28425
28425
  // src/primitives/thumbnails.ts
28426
28426
  async function getThumbnailUrls(playbackId, duration, options = {}) {
28427
28427
  "use step";
28428
- const { interval = 10, width = 640, shouldSign = false, credentials } = options;
28429
- const timestamps = [];
28428
+ const { interval = 10, width = 640, shouldSign = false, maxSamples, credentials } = options;
28429
+ let timestamps = [];
28430
28430
  if (duration <= 50) {
28431
28431
  const spacing = duration / 6;
28432
28432
  for (let i = 1; i <= 5; i++) {
@@ -28437,6 +28437,18 @@ async function getThumbnailUrls(playbackId, duration, options = {}) {
28437
28437
  timestamps.push(time);
28438
28438
  }
28439
28439
  }
28440
+ if (maxSamples !== void 0 && timestamps.length > maxSamples) {
28441
+ const newTimestamps = [];
28442
+ newTimestamps.push(0);
28443
+ if (maxSamples >= 2) {
28444
+ const spacing = duration / (maxSamples - 1);
28445
+ for (let i = 1; i < maxSamples - 1; i++) {
28446
+ newTimestamps.push(spacing * i);
28447
+ }
28448
+ newTimestamps.push(duration);
28449
+ }
28450
+ timestamps = newTimestamps;
28451
+ }
28440
28452
  const baseUrl = `https://image.mux.com/${playbackId}/thumbnail.png`;
28441
28453
  const urlPromises = timestamps.map(async (time) => {
28442
28454
  if (shouldSign) {