@mux/ai 0.5.0 → 0.5.1
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-B5bQ-IQk.d.ts} +2 -0
- package/dist/{index-BdpEVCbj.d.ts → index-D4eU6RMH.d.ts} +2 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.js +14 -2
- package/dist/primitives/index.js.map +1 -1
- package/dist/workflows/index.d.ts +1 -1
- package/dist/workflows/index.js +16 -2
- package/dist/workflows/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -110,6 +110,8 @@ interface ThumbnailOptions {
|
|
|
110
110
|
width?: number;
|
|
111
111
|
/** Flag for whether or not to use signed playback IDs (default: false) */
|
|
112
112
|
shouldSign?: boolean;
|
|
113
|
+
/** Maximum number of thumbnails to generate. When set, samples are evenly distributed with first and last frames pinned. */
|
|
114
|
+
maxSamples?: number;
|
|
113
115
|
/** Workflow credentials for signing (optional). */
|
|
114
116
|
credentials?: WorkflowCredentialsInput;
|
|
115
117
|
}
|
|
@@ -292,6 +292,8 @@ interface ModerationOptions extends MuxAIOptions {
|
|
|
292
292
|
thumbnailInterval?: number;
|
|
293
293
|
/** Width of storyboard thumbnails in pixels (defaults to 640). */
|
|
294
294
|
thumbnailWidth?: number;
|
|
295
|
+
/** Maximum number of thumbnails to sample (defaults to unlimited). When set, samples are evenly distributed with first and last frames pinned. */
|
|
296
|
+
maxSamples?: number;
|
|
295
297
|
/** Max concurrent moderation requests (defaults to 5). */
|
|
296
298
|
maxConcurrent?: number;
|
|
297
299
|
/** Transport used for thumbnails (defaults to 'url'). */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { W as WorkflowCredentials } from './types-KcVfWtUl.js';
|
|
2
2
|
export { A as AssetTextTrack, i as ChunkEmbedding, C as ChunkingStrategy, E as Encrypted, a as EncryptedPayload, I as ImageSubmissionMode, M as MuxAIOptions, c as MuxAsset, f as PlaybackAsset, P as PlaybackPolicy, h as TextChunk, g as TokenChunkingConfig, k as TokenUsage, T as ToneType, V as VTTChunkingConfig, j as VideoEmbeddingsResult, b as WorkflowCredentialsInput, d as decryptFromWorkflow, e as encryptForWorkflow } from './types-KcVfWtUl.js';
|
|
3
|
-
export { i as primitives } from './index-
|
|
4
|
-
export { i as workflows } from './index-
|
|
3
|
+
export { i as primitives } from './index-B5bQ-IQk.js';
|
|
4
|
+
export { i as workflows } from './index-D4eU6RMH.js';
|
|
5
5
|
import '@mux/mux-node';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import '@ai-sdk/anthropic';
|
|
8
8
|
import '@ai-sdk/google';
|
|
9
9
|
import '@ai-sdk/openai';
|
|
10
10
|
|
|
11
|
-
var version = "0.5.
|
|
11
|
+
var version = "0.5.1";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A function that returns workflow credentials, either synchronously or asynchronously.
|
package/dist/index.js
CHANGED
|
@@ -28018,7 +28018,7 @@ var init_dist10 = __esm({
|
|
|
28018
28018
|
});
|
|
28019
28019
|
|
|
28020
28020
|
// package.json
|
|
28021
|
-
var version = "0.5.
|
|
28021
|
+
var version = "0.5.1";
|
|
28022
28022
|
|
|
28023
28023
|
// src/env.ts
|
|
28024
28024
|
import { z } from "zod";
|
|
@@ -28534,8 +28534,8 @@ function chunkText(text, strategy) {
|
|
|
28534
28534
|
// src/primitives/thumbnails.ts
|
|
28535
28535
|
async function getThumbnailUrls(playbackId, duration, options = {}) {
|
|
28536
28536
|
"use step";
|
|
28537
|
-
const { interval = 10, width = 640, shouldSign = false, credentials } = options;
|
|
28538
|
-
|
|
28537
|
+
const { interval = 10, width = 640, shouldSign = false, maxSamples, credentials } = options;
|
|
28538
|
+
let timestamps = [];
|
|
28539
28539
|
if (duration <= 50) {
|
|
28540
28540
|
const spacing = duration / 6;
|
|
28541
28541
|
for (let i = 1; i <= 5; i++) {
|
|
@@ -28546,6 +28546,18 @@ async function getThumbnailUrls(playbackId, duration, options = {}) {
|
|
|
28546
28546
|
timestamps.push(time);
|
|
28547
28547
|
}
|
|
28548
28548
|
}
|
|
28549
|
+
if (maxSamples !== void 0 && timestamps.length > maxSamples) {
|
|
28550
|
+
const newTimestamps = [];
|
|
28551
|
+
newTimestamps.push(0);
|
|
28552
|
+
if (maxSamples >= 2) {
|
|
28553
|
+
const spacing = duration / (maxSamples - 1);
|
|
28554
|
+
for (let i = 1; i < maxSamples - 1; i++) {
|
|
28555
|
+
newTimestamps.push(spacing * i);
|
|
28556
|
+
}
|
|
28557
|
+
newTimestamps.push(duration);
|
|
28558
|
+
}
|
|
28559
|
+
timestamps = newTimestamps;
|
|
28560
|
+
}
|
|
28549
28561
|
const baseUrl = `https://image.mux.com/${playbackId}/thumbnail.png`;
|
|
28550
28562
|
const urlPromises = timestamps.map(async (time) => {
|
|
28551
28563
|
if (shouldSign) {
|
|
@@ -29910,6 +29922,7 @@ async function getModerationScores(assetId, options = {}) {
|
|
|
29910
29922
|
thresholds = DEFAULT_THRESHOLDS,
|
|
29911
29923
|
thumbnailInterval = 10,
|
|
29912
29924
|
thumbnailWidth = 640,
|
|
29925
|
+
maxSamples,
|
|
29913
29926
|
maxConcurrent = 5,
|
|
29914
29927
|
imageSubmissionMode = "url",
|
|
29915
29928
|
imageDownloadOptions,
|
|
@@ -29961,6 +29974,7 @@ async function getModerationScores(assetId, options = {}) {
|
|
|
29961
29974
|
interval: thumbnailInterval,
|
|
29962
29975
|
width: thumbnailWidth,
|
|
29963
29976
|
shouldSign: policy === "signed",
|
|
29977
|
+
maxSamples,
|
|
29964
29978
|
credentials
|
|
29965
29979
|
});
|
|
29966
29980
|
if (provider === "openai") {
|