@mux/ai 0.45.0 → 0.46.0
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-BD4acrwt.d.ts → index-CIcGZD3x.d.ts} +7 -7
- package/dist/{index-D6VGaoPm.d.ts → index-DAuzEXly.d.ts} +11 -11
- package/dist/index.d.ts +6 -6
- package/dist/index.js +56 -67
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +3 -3
- package/dist/primitives/index.js +55 -66
- package/dist/primitives/index.js.map +1 -1
- package/dist/{shots-B7G0IIF1.d.ts → shots-BwpjZDpr.d.ts} +3 -3
- package/dist/workflows/index.d.ts +3 -3
- package/dist/workflows/index.js +51 -60
- package/dist/workflows/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ import { S as SafetyReport, e as PromptOverrides, h as SceneContextItemV1, D as
|
|
|
3
3
|
import { createAnthropic } from '@ai-sdk/anthropic';
|
|
4
4
|
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
5
5
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
6
|
-
import { l as WorkflowCredentialsInput, d as MuxAsset, A as AssetTextTrack, f as ScopedMuxAIOptions, I as ImageSubmissionMode, i as TokenUsage, M as MuxAIOptions, b as ChunkingStrategy, k as VideoEmbeddingsResult, H as Hotspot, v as Shot, j as ToneType, g as StorageAdapter } from './shots-
|
|
6
|
+
import { l as WorkflowCredentialsInput, d as MuxAsset, A as AssetTextTrack, f as ScopedMuxAIOptions, I as ImageSubmissionMode, i as TokenUsage, M as MuxAIOptions, b as ChunkingStrategy, k as VideoEmbeddingsResult, H as Hotspot, v as Shot, j as ToneType, g as StorageAdapter } from './shots-BwpjZDpr.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Language Code Conversion Utilities
|
|
@@ -490,17 +490,17 @@ declare const questionAnswerSchema: z.ZodObject<{
|
|
|
490
490
|
reasoning: z.ZodString;
|
|
491
491
|
skipped: z.ZodBoolean;
|
|
492
492
|
}, "strip", z.ZodTypeAny, {
|
|
493
|
+
skipped: boolean;
|
|
493
494
|
question: string;
|
|
494
495
|
answer: string | null;
|
|
495
496
|
confidence: number;
|
|
496
497
|
reasoning: string;
|
|
497
|
-
skipped: boolean;
|
|
498
498
|
}, {
|
|
499
|
+
skipped: boolean;
|
|
499
500
|
question: string;
|
|
500
501
|
answer: string | null;
|
|
501
502
|
confidence: number;
|
|
502
503
|
reasoning: string;
|
|
503
|
-
skipped: boolean;
|
|
504
504
|
}>;
|
|
505
505
|
type QuestionAnswerType = z.infer<typeof questionAnswerSchema>;
|
|
506
506
|
/**
|
|
@@ -517,33 +517,33 @@ declare function createAskQuestionsSchema(answerSchema: z.ZodType<string>): z.Zo
|
|
|
517
517
|
} & {
|
|
518
518
|
answer: z.ZodType<string, z.ZodTypeDef, string>;
|
|
519
519
|
}, "strip", z.ZodTypeAny, {
|
|
520
|
+
skipped: boolean;
|
|
520
521
|
question: string;
|
|
521
522
|
answer: string;
|
|
522
523
|
confidence: number;
|
|
523
524
|
reasoning: string;
|
|
524
|
-
skipped: boolean;
|
|
525
525
|
}, {
|
|
526
|
+
skipped: boolean;
|
|
526
527
|
question: string;
|
|
527
528
|
answer: string;
|
|
528
529
|
confidence: number;
|
|
529
530
|
reasoning: string;
|
|
530
|
-
skipped: boolean;
|
|
531
531
|
}>, "many">;
|
|
532
532
|
}, "strip", z.ZodTypeAny, {
|
|
533
533
|
answers: {
|
|
534
|
+
skipped: boolean;
|
|
534
535
|
question: string;
|
|
535
536
|
answer: string;
|
|
536
537
|
confidence: number;
|
|
537
538
|
reasoning: string;
|
|
538
|
-
skipped: boolean;
|
|
539
539
|
}[];
|
|
540
540
|
}, {
|
|
541
541
|
answers: {
|
|
542
|
+
skipped: boolean;
|
|
542
543
|
question: string;
|
|
543
544
|
answer: string;
|
|
544
545
|
confidence: number;
|
|
545
546
|
reasoning: string;
|
|
546
|
-
skipped: boolean;
|
|
547
547
|
}[];
|
|
548
548
|
}>;
|
|
549
549
|
type AskQuestionsSchema = ReturnType<typeof createAskQuestionsSchema>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as WorkflowCredentialsInput, n as WorkflowScope, A as AssetTextTrack, d as MuxAsset, T as TextChunk, b as ChunkingStrategy, q as CompletedShotsResult, r as ErroredShotsResult, H as Hotspot, s as HotspotOptions, t as HotspotResponse, u as PendingShotsResult, v as Shot, w as ShotRequestOptions, x as ShotsResult, y as WaitForShotsOptions, z as getHotspotsForAsset, B as getHotspotsForPlaybackId, D as getHotspotsForVideo, F as getShotsForAsset, G as requestShotsForAsset, J as waitForShotsForAsset } from './shots-
|
|
1
|
+
import { l as WorkflowCredentialsInput, n as WorkflowScope, A as AssetTextTrack, d as MuxAsset, T as TextChunk, b as ChunkingStrategy, q as CompletedShotsResult, r as ErroredShotsResult, H as Hotspot, s as HotspotOptions, t as HotspotResponse, u as PendingShotsResult, v as Shot, w as ShotRequestOptions, x as ShotsResult, y as WaitForShotsOptions, z as getHotspotsForAsset, B as getHotspotsForPlaybackId, D as getHotspotsForVideo, F as getShotsForAsset, G as requestShotsForAsset, J as waitForShotsForAsset } from './shots-BwpjZDpr.js';
|
|
2
2
|
|
|
3
3
|
interface HeatmapOptions {
|
|
4
4
|
/** Time window for results, e.g., '7:days' (default: '7:days') */
|
|
@@ -10,38 +10,38 @@ interface HeatmapResponse {
|
|
|
10
10
|
assetId?: string;
|
|
11
11
|
videoId?: string;
|
|
12
12
|
playbackId?: string;
|
|
13
|
-
/**
|
|
13
|
+
/** Engagement values across the video timeline, one per equal slice (currently 100) */
|
|
14
14
|
heatmap: number[];
|
|
15
15
|
timeframe: [number, number];
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Fetches engagement heatmap for a Mux asset.
|
|
19
|
-
* Returns
|
|
20
|
-
* that
|
|
19
|
+
* Returns an array where each value represents how many times
|
|
20
|
+
* that slice of the video was watched.
|
|
21
21
|
*
|
|
22
22
|
* @param assetId - The Mux asset ID
|
|
23
23
|
* @param options - Heatmap query options
|
|
24
|
-
* @returns Heatmap data with
|
|
24
|
+
* @returns Heatmap data with per-bucket engagement values
|
|
25
25
|
*/
|
|
26
26
|
declare function getHeatmapForAsset(assetId: string, options?: HeatmapOptions): Promise<HeatmapResponse>;
|
|
27
27
|
/**
|
|
28
28
|
* Fetches engagement heatmap for a Mux video ID.
|
|
29
|
-
* Returns
|
|
30
|
-
* that
|
|
29
|
+
* Returns an array where each value represents how many times
|
|
30
|
+
* that slice of the video was watched.
|
|
31
31
|
*
|
|
32
32
|
* @param videoId - The Mux video ID
|
|
33
33
|
* @param options - Heatmap query options
|
|
34
|
-
* @returns Heatmap data with
|
|
34
|
+
* @returns Heatmap data with per-bucket engagement values
|
|
35
35
|
*/
|
|
36
36
|
declare function getHeatmapForVideo(videoId: string, options?: HeatmapOptions): Promise<HeatmapResponse>;
|
|
37
37
|
/**
|
|
38
38
|
* Fetches engagement heatmap for a Mux playback ID.
|
|
39
|
-
* Returns
|
|
40
|
-
* that
|
|
39
|
+
* Returns an array where each value represents how many times
|
|
40
|
+
* that slice of the video was watched.
|
|
41
41
|
*
|
|
42
42
|
* @param playbackId - The Mux playback ID
|
|
43
43
|
* @param options - Heatmap query options
|
|
44
|
-
* @returns Heatmap data with
|
|
44
|
+
* @returns Heatmap data with per-bucket engagement values
|
|
45
45
|
*/
|
|
46
46
|
declare function getHeatmapForPlaybackId(playbackId: string, options?: HeatmapOptions): Promise<HeatmapResponse>;
|
|
47
47
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export { I as ISO639_1, a as ISO639_3, L as LanguageCodePair, M as MUX_TRACK_PASSTHROUGH_MAX_CHARS, R as ReplaceAndCreateTextTrackInput, b as ReplaceAndCreateTextTrackResult, c as ReplaceAndCreateTrackInput, d as ReplaceExistingTracksPolicy, e as ReplaceableTrackType, S as SupportedISO639_1, f as SupportedISO639_3, T as TextTrackReplacementPlan, g as TextTrackSummary, h as TextTrackTarget, i as TrackSummary, j as TrackTarget, k as buildMuxAiTrackPassthrough, l as findNameCollisionTextTracks, m as findSameLanguageTextTracks, n as getLanguageCodePair, o as getLanguageName, p as isDuplicateTrackNameError, q as isMuxGeneratedTextTrack, r as isUndeterminedLanguageCode, s as isValidISO639_1, t as isValidISO639_3, u as normalizeTrackLanguageCode, v as normalizeTrackName, w as planTextTrackReplacement, x as replaceAndCreateTextTrack, y as replaceAndCreateTrack, z as summarizeTextTrack, A as toISO639_1, B as toISO639_3, C as validateTrackPassthrough, D as workflows } from './index-
|
|
2
|
-
import { W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './shots-
|
|
3
|
-
export { A as AssetTextTrack, C as ChunkEmbedding, b as ChunkingStrategy, E as Encrypted, c as EncryptedPayload, I as ImageSubmissionMode, M as MuxAIOptions, d as MuxAsset, P as PlaybackAsset, e as PlaybackPolicy, f as ScopedMuxAIOptions, g as StorageAdapter, T as TextChunk, h as TokenChunkingConfig, i as TokenUsage, j as ToneType, U as UsageMetadata, V as VTTChunkingConfig, k as VideoEmbeddingsResult, l as WorkflowCredentialsInput, m as WorkflowMuxClient, n as WorkflowScope, o as decryptFromWorkflow, p as encryptForWorkflow } from './shots-
|
|
1
|
+
export { I as ISO639_1, a as ISO639_3, L as LanguageCodePair, M as MUX_TRACK_PASSTHROUGH_MAX_CHARS, R as ReplaceAndCreateTextTrackInput, b as ReplaceAndCreateTextTrackResult, c as ReplaceAndCreateTrackInput, d as ReplaceExistingTracksPolicy, e as ReplaceableTrackType, S as SupportedISO639_1, f as SupportedISO639_3, T as TextTrackReplacementPlan, g as TextTrackSummary, h as TextTrackTarget, i as TrackSummary, j as TrackTarget, k as buildMuxAiTrackPassthrough, l as findNameCollisionTextTracks, m as findSameLanguageTextTracks, n as getLanguageCodePair, o as getLanguageName, p as isDuplicateTrackNameError, q as isMuxGeneratedTextTrack, r as isUndeterminedLanguageCode, s as isValidISO639_1, t as isValidISO639_3, u as normalizeTrackLanguageCode, v as normalizeTrackName, w as planTextTrackReplacement, x as replaceAndCreateTextTrack, y as replaceAndCreateTrack, z as summarizeTextTrack, A as toISO639_1, B as toISO639_3, C as validateTrackPassthrough, D as workflows } from './index-CIcGZD3x.js';
|
|
2
|
+
import { W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './shots-BwpjZDpr.js';
|
|
3
|
+
export { A as AssetTextTrack, C as ChunkEmbedding, b as ChunkingStrategy, E as Encrypted, c as EncryptedPayload, I as ImageSubmissionMode, M as MuxAIOptions, d as MuxAsset, P as PlaybackAsset, e as PlaybackPolicy, f as ScopedMuxAIOptions, g as StorageAdapter, T as TextChunk, h as TokenChunkingConfig, i as TokenUsage, j as ToneType, U as UsageMetadata, V as VTTChunkingConfig, k as VideoEmbeddingsResult, l as WorkflowCredentialsInput, m as WorkflowMuxClient, n as WorkflowScope, o as decryptFromWorkflow, p as encryptForWorkflow } from './shots-BwpjZDpr.js';
|
|
4
4
|
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
|
|
5
|
-
export { i as primitives } from './index-
|
|
5
|
+
export { i as primitives } from './index-DAuzEXly.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import './summarization-BFmhXeAu.js';
|
|
8
8
|
import '@ai-sdk/anthropic';
|
|
9
9
|
import '@ai-sdk/google';
|
|
10
10
|
import '@ai-sdk/openai';
|
|
11
|
-
import '@mux/
|
|
11
|
+
import '@mux/ts';
|
|
12
12
|
|
|
13
|
-
var version = "0.
|
|
13
|
+
var version = "0.46.0";
|
|
14
14
|
|
|
15
15
|
type MuxAiErrorType = "validation_error" | "processing_error" | "timeout_error" | "content_policy_error";
|
|
16
16
|
/**
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// package.json
|
|
8
|
-
var version = "0.
|
|
8
|
+
var version = "0.46.0";
|
|
9
9
|
|
|
10
10
|
// src/lib/language-codes.ts
|
|
11
11
|
var ISO639_1_TO_3 = {
|
|
@@ -1055,7 +1055,7 @@ function resolveDirectMuxCredentials(record) {
|
|
|
1055
1055
|
function createWorkflowMuxClient(options) {
|
|
1056
1056
|
return {
|
|
1057
1057
|
async createClient() {
|
|
1058
|
-
const { default: MuxClient } = await import("@mux/
|
|
1058
|
+
const { default: MuxClient } = await import("@mux/ts");
|
|
1059
1059
|
return new MuxClient({
|
|
1060
1060
|
tokenId: options.tokenId,
|
|
1061
1061
|
tokenSecret: options.tokenSecret,
|
|
@@ -2182,25 +2182,22 @@ async function getHeatmapForPlaybackId(playbackId, options = {}) {
|
|
|
2182
2182
|
"use step";
|
|
2183
2183
|
return fetchHeatmap("playback-ids", playbackId, options);
|
|
2184
2184
|
}
|
|
2185
|
-
function transformHeatmapResponse(response) {
|
|
2186
|
-
return {
|
|
2187
|
-
assetId: response.data.asset_id,
|
|
2188
|
-
videoId: response.data.video_id,
|
|
2189
|
-
playbackId: response.data.playback_id,
|
|
2190
|
-
heatmap: response.data.heatmap,
|
|
2191
|
-
timeframe: response.timeframe
|
|
2192
|
-
};
|
|
2193
|
-
}
|
|
2194
2185
|
async function fetchHeatmap(identifierType, id, options) {
|
|
2195
2186
|
"use step";
|
|
2196
2187
|
const { timeframe = "7:days", credentials } = options;
|
|
2197
2188
|
const muxClient = await getMuxClientFromEnv(credentials);
|
|
2198
2189
|
const mux = await muxClient.createClient();
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2201
|
-
const
|
|
2202
|
-
const
|
|
2203
|
-
return
|
|
2190
|
+
const query = { timeframe: [timeframe] };
|
|
2191
|
+
const resource = identifierType === "playback-ids" ? mux.data.engagement.playbackIds : mux.data.engagement[identifierType];
|
|
2192
|
+
const response = await resource.heatmap(id, query);
|
|
2193
|
+
const { data } = response;
|
|
2194
|
+
return {
|
|
2195
|
+
assetId: data.asset_id ?? (identifierType === "assets" ? id : void 0),
|
|
2196
|
+
videoId: data.video_id ?? (identifierType === "videos" ? id : void 0),
|
|
2197
|
+
playbackId: data.playback_id ?? (identifierType === "playback-ids" ? id : void 0),
|
|
2198
|
+
heatmap: data.heatmap,
|
|
2199
|
+
timeframe: response.timeframe
|
|
2200
|
+
};
|
|
2204
2201
|
}
|
|
2205
2202
|
|
|
2206
2203
|
// src/primitives/hotspots.ts
|
|
@@ -2219,37 +2216,34 @@ async function getHotspotsForPlaybackId(playbackId, options = {}) {
|
|
|
2219
2216
|
const response = await fetchHotspots("playback-ids", playbackId, options);
|
|
2220
2217
|
return response.hotspots;
|
|
2221
2218
|
}
|
|
2222
|
-
function transformHotspotResponse(response) {
|
|
2223
|
-
return {
|
|
2224
|
-
assetId: response.data.asset_id,
|
|
2225
|
-
videoId: response.data.video_id,
|
|
2226
|
-
playbackId: response.data.playback_id,
|
|
2227
|
-
hotspots: response.data.hotspots.map((h) => ({
|
|
2228
|
-
startMs: h.start_ms,
|
|
2229
|
-
endMs: h.end_ms,
|
|
2230
|
-
score: h.score
|
|
2231
|
-
}))
|
|
2232
|
-
};
|
|
2233
|
-
}
|
|
2234
2219
|
async function fetchHotspots(identifierType, id, options) {
|
|
2235
2220
|
"use step";
|
|
2236
2221
|
const {
|
|
2237
2222
|
limit = 5,
|
|
2238
2223
|
orderDirection = "desc",
|
|
2239
|
-
orderBy = "score",
|
|
2240
2224
|
timeframe = "7:days",
|
|
2241
2225
|
credentials
|
|
2242
2226
|
} = options;
|
|
2243
2227
|
const muxClient = await getMuxClientFromEnv(credentials);
|
|
2244
2228
|
const mux = await muxClient.createClient();
|
|
2245
|
-
const
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
const
|
|
2251
|
-
const response = await
|
|
2252
|
-
|
|
2229
|
+
const query = {
|
|
2230
|
+
limit,
|
|
2231
|
+
order_direction: orderDirection,
|
|
2232
|
+
timeframe: [timeframe]
|
|
2233
|
+
};
|
|
2234
|
+
const resource = identifierType === "playback-ids" ? mux.data.engagement.playbackIds : mux.data.engagement[identifierType];
|
|
2235
|
+
const response = await resource.hotspots(id, query);
|
|
2236
|
+
const { data } = response;
|
|
2237
|
+
return {
|
|
2238
|
+
assetId: data.asset_id ?? (identifierType === "assets" ? id : void 0),
|
|
2239
|
+
videoId: data.video_id ?? (identifierType === "videos" ? id : void 0),
|
|
2240
|
+
playbackId: data.playback_id ?? (identifierType === "playback-ids" ? id : void 0),
|
|
2241
|
+
hotspots: data.hotspots.map((h) => ({
|
|
2242
|
+
startMs: h.start_ms,
|
|
2243
|
+
endMs: h.end_ms,
|
|
2244
|
+
score: h.score
|
|
2245
|
+
}))
|
|
2246
|
+
};
|
|
2253
2247
|
}
|
|
2254
2248
|
|
|
2255
2249
|
// src/primitives/shots.ts
|
|
@@ -2257,9 +2251,6 @@ var DEFAULT_POLL_INTERVAL_MS = 2e3;
|
|
|
2257
2251
|
var MIN_POLL_INTERVAL_MS = 1e3;
|
|
2258
2252
|
var DEFAULT_MAX_ATTEMPTS = 60;
|
|
2259
2253
|
var SHOTS_ALREADY_REQUESTED_MESSAGE = "shots generation has already been requested";
|
|
2260
|
-
function getShotsPath(assetId) {
|
|
2261
|
-
return `/video/v1/assets/${assetId}/shots`;
|
|
2262
|
-
}
|
|
2263
2254
|
function mapManifestShots(shots) {
|
|
2264
2255
|
let usedDeprecatedField = false;
|
|
2265
2256
|
const mapped = shots.map((shot, index) => {
|
|
@@ -2299,29 +2290,35 @@ async function fetchShotsFromManifest(shotsManifestUrl) {
|
|
|
2299
2290
|
}
|
|
2300
2291
|
return mapManifestShots(manifest.shots);
|
|
2301
2292
|
}
|
|
2302
|
-
async function transformShotsResponse(
|
|
2303
|
-
switch (
|
|
2293
|
+
async function transformShotsResponse(data) {
|
|
2294
|
+
switch (data.status) {
|
|
2304
2295
|
case "pending":
|
|
2305
2296
|
return {
|
|
2306
2297
|
status: "pending",
|
|
2307
|
-
createdAt:
|
|
2298
|
+
createdAt: data.created_at
|
|
2308
2299
|
};
|
|
2309
|
-
case "errored":
|
|
2300
|
+
case "errored": {
|
|
2301
|
+
const details = data.errors ?? data.error;
|
|
2310
2302
|
return {
|
|
2311
2303
|
status: "errored",
|
|
2312
|
-
createdAt:
|
|
2313
|
-
error:
|
|
2304
|
+
createdAt: data.created_at,
|
|
2305
|
+
error: {
|
|
2306
|
+
type: details?.type ?? "unknown",
|
|
2307
|
+
messages: details?.messages ?? []
|
|
2308
|
+
}
|
|
2314
2309
|
};
|
|
2310
|
+
}
|
|
2315
2311
|
case "completed":
|
|
2312
|
+
if (!data.shots_manifest_url) {
|
|
2313
|
+
throw new Error("Completed shots response is missing shots_manifest_url");
|
|
2314
|
+
}
|
|
2316
2315
|
return {
|
|
2317
2316
|
status: "completed",
|
|
2318
|
-
createdAt:
|
|
2319
|
-
shots: await fetchShotsFromManifest(
|
|
2317
|
+
createdAt: data.created_at,
|
|
2318
|
+
shots: await fetchShotsFromManifest(data.shots_manifest_url)
|
|
2320
2319
|
};
|
|
2321
|
-
default:
|
|
2322
|
-
|
|
2323
|
-
throw new Error(`Unsupported shots response: ${JSON.stringify(exhaustiveCheck)}`);
|
|
2324
|
-
}
|
|
2320
|
+
default:
|
|
2321
|
+
throw new Error(`Unsupported shots status '${data.status}'`);
|
|
2325
2322
|
}
|
|
2326
2323
|
}
|
|
2327
2324
|
function sleep(ms) {
|
|
@@ -2329,7 +2326,8 @@ function sleep(ms) {
|
|
|
2329
2326
|
}
|
|
2330
2327
|
function isShotsAlreadyRequestedError(error) {
|
|
2331
2328
|
const statusCode = error?.status ?? error?.statusCode;
|
|
2332
|
-
const
|
|
2329
|
+
const body = error?.error;
|
|
2330
|
+
const messages = body?.error?.messages ?? body?.messages;
|
|
2333
2331
|
const lowerCaseMessages = messages?.map((message) => message.toLowerCase()) ?? [];
|
|
2334
2332
|
const errorMessage = error instanceof Error ? error.message.toLowerCase() : "";
|
|
2335
2333
|
return statusCode === 400 && (lowerCaseMessages.some((message) => message.includes(SHOTS_ALREADY_REQUESTED_MESSAGE)) || errorMessage.includes(SHOTS_ALREADY_REQUESTED_MESSAGE));
|
|
@@ -2339,11 +2337,8 @@ async function requestShotsForAsset(assetId, options = {}) {
|
|
|
2339
2337
|
const { credentials } = options;
|
|
2340
2338
|
const muxClient = await getMuxClientFromEnv(credentials);
|
|
2341
2339
|
const mux = await muxClient.createClient();
|
|
2342
|
-
const
|
|
2343
|
-
|
|
2344
|
-
{ body: {} }
|
|
2345
|
-
);
|
|
2346
|
-
const result = await transformShotsResponse(response);
|
|
2340
|
+
const data = await mux.video.assets.generateShots(assetId, {});
|
|
2341
|
+
const result = await transformShotsResponse(data);
|
|
2347
2342
|
if (result.status !== "pending") {
|
|
2348
2343
|
throw new Error(
|
|
2349
2344
|
`Expected pending status after requesting shots for asset '${assetId}', received '${result.status}'`
|
|
@@ -2356,10 +2351,8 @@ async function getShotsForAsset(assetId, options = {}) {
|
|
|
2356
2351
|
const { credentials } = options;
|
|
2357
2352
|
const muxClient = await getMuxClientFromEnv(credentials);
|
|
2358
2353
|
const mux = await muxClient.createClient();
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2361
|
-
);
|
|
2362
|
-
return await transformShotsResponse(response);
|
|
2354
|
+
const data = await mux.video.assets.retrieveShots(assetId);
|
|
2355
|
+
return await transformShotsResponse(data);
|
|
2363
2356
|
}
|
|
2364
2357
|
async function waitForShotsForAsset(assetId, options = {}) {
|
|
2365
2358
|
"use step";
|
|
@@ -2402,12 +2395,8 @@ async function waitForShotsForAsset(assetId, options = {}) {
|
|
|
2402
2395
|
|
|
2403
2396
|
// src/lib/url-signing.ts
|
|
2404
2397
|
async function createSigningClient(context) {
|
|
2405
|
-
const { default: MuxClient } = await import("@mux/
|
|
2398
|
+
const { default: MuxClient } = await import("@mux/ts");
|
|
2406
2399
|
return new MuxClient({
|
|
2407
|
-
// These are not needed for signing, but the SDK requires them
|
|
2408
|
-
// Using empty strings as we only need the jwt functionality
|
|
2409
|
-
tokenId: env_default.MUX_TOKEN_ID || "",
|
|
2410
|
-
tokenSecret: env_default.MUX_TOKEN_SECRET || "",
|
|
2411
2400
|
jwtSigningKey: context.keyId,
|
|
2412
2401
|
jwtPrivateKey: context.keySecret
|
|
2413
2402
|
});
|