@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.
- package/dist/{index-Dmo55n-5.d.ts → index-2oUwgWsE.d.ts} +3 -1
- package/dist/{index-BdpEVCbj.d.ts → index-DgCfxP4T.d.ts} +11 -9
- package/dist/index.d.ts +5 -5
- package/dist/index.js +42 -29
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +2 -2
- package/dist/primitives/index.js +14 -2
- package/dist/primitives/index.js.map +1 -1
- package/dist/{types-KcVfWtUl.d.ts → types-BhVuLeSp.d.ts} +0 -6
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/index.js +41 -28
- package/dist/workflows/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -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-
|
|
2
|
-
import '../types-
|
|
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';
|
package/dist/primitives/index.js
CHANGED
|
@@ -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
|
-
|
|
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) {
|