docs
0
# Video Module
1
2
The Video module provides comprehensive video management capabilities including VOD asset creation, live streaming, direct uploads, playback ID management, DRM configuration, transcription, and delivery reporting.
3
4
## Imports
5
6
```typescript
7
import Mux from '@mux/mux-node';
8
9
const client = new Mux({
10
tokenId: 'YOUR_TOKEN_ID',
11
tokenSecret: 'YOUR_TOKEN_SECRET',
12
});
13
14
// Access video resources
15
const assets = client.video.assets;
16
const liveStreams = client.video.liveStreams;
17
const uploads = client.video.uploads;
18
```
19
20
## Capabilities
21
22
### Video Assets
23
24
Manage video-on-demand (VOD) assets including creation, processing, metadata, tracks, and static renditions.
25
26
```typescript { .api }
27
interface Assets {
28
/**
29
* Create a new video asset
30
*/
31
create(body: AssetCreateParams, options?: RequestOptions): Promise<Asset>;
32
33
/**
34
* Retrieve asset details
35
*/
36
retrieve(assetId: string, options?: RequestOptions): Promise<Asset>;
37
38
/**
39
* Update asset properties (currently supports passthrough only)
40
*/
41
update(assetId: string, body: AssetUpdateParams, options?: RequestOptions): Promise<Asset>;
42
43
/**
44
* List all assets with pagination
45
*/
46
list(query?: AssetListParams, options?: RequestOptions): PagePromise<AssetsBasePage, Asset>;
47
48
/**
49
* Delete a video asset and all its data
50
*/
51
delete(assetId: string, options?: RequestOptions): Promise<void>;
52
53
/**
54
* Create a playback ID for streaming the asset
55
*/
56
createPlaybackId(
57
assetId: string,
58
body: AssetCreatePlaybackIDParams,
59
options?: RequestOptions
60
): Promise<PlaybackID>;
61
62
/**
63
* Delete a playback ID from the asset
64
*/
65
deletePlaybackId(
66
assetId: string,
67
playbackId: string,
68
options?: RequestOptions
69
): Promise<void>;
70
71
/**
72
* Retrieve playback ID information
73
*/
74
retrievePlaybackId(
75
assetId: string,
76
playbackId: string,
77
options?: RequestOptions
78
): Promise<PlaybackID>;
79
80
/**
81
* Add a track (subtitles, captions, or audio) to an asset
82
*/
83
createTrack(
84
assetId: string,
85
body: AssetCreateTrackParams,
86
options?: RequestOptions
87
): Promise<Track>;
88
89
/**
90
* Delete a track from an asset
91
*/
92
deleteTrack(
93
assetId: string,
94
trackId: string,
95
options?: RequestOptions
96
): Promise<void>;
97
98
/**
99
* Generate AI subtitles for an audio track
100
*/
101
generateSubtitles(
102
assetId: string,
103
trackId: string,
104
body: AssetGenerateSubtitlesParams,
105
options?: RequestOptions
106
): Promise<AssetGenerateSubtitlesResponse>;
107
108
/**
109
* Create a static MP4 rendition for an asset
110
*/
111
createStaticRendition(
112
assetId: string,
113
body: AssetCreateStaticRenditionParams,
114
options?: RequestOptions
115
): Promise<AssetCreateStaticRenditionResponse>;
116
117
/**
118
* Delete a static rendition
119
*/
120
deleteStaticRendition(
121
assetId: string,
122
staticRenditionId: string,
123
options?: RequestOptions
124
): Promise<void>;
125
126
/**
127
* Get information about the input sources used to create the asset
128
*/
129
retrieveInputInfo(
130
assetId: string,
131
options?: RequestOptions
132
): Promise<AssetRetrieveInputInfoResponse>;
133
134
/**
135
* Enable temporary access to the master MP4 file (24 hours)
136
*/
137
updateMasterAccess(
138
assetId: string,
139
body: AssetUpdateMasterAccessParams,
140
options?: RequestOptions
141
): Promise<Asset>;
142
143
/**
144
* Add or remove MP4 support (deprecated - use createStaticRendition)
145
* @deprecated
146
*/
147
updateMP4Support(
148
assetId: string,
149
body: AssetUpdateMP4SupportParams,
150
options?: RequestOptions
151
): Promise<Asset>;
152
}
153
154
interface AssetCreateParams {
155
/** Input sources for the asset */
156
inputs: Array<Input>;
157
/** Playback policies ('public', 'signed', 'drm') */
158
playback_policies?: Array<PlaybackPolicy>;
159
/** Video quality tier ('basic', 'plus', 'premium') */
160
video_quality?: 'basic' | 'plus' | 'premium';
161
/** Master file access setting ('temporary', 'none') */
162
master_access?: 'temporary' | 'none';
163
/** Maximum resolution tier ('1080p', '1440p', '2160p') */
164
max_resolution_tier?: '1080p' | '1440p' | '2160p';
165
/** Create test asset (watermarked, 10s limit, 24hr TTL) */
166
test?: boolean;
167
/** Custom metadata (max 255 chars) */
168
passthrough?: string;
169
/** Normalize audio levels */
170
normalize_audio?: boolean;
171
/** Structured metadata */
172
meta?: {
173
title?: string;
174
external_id?: string;
175
creator_id?: string;
176
};
177
/** MP4 support setting (deprecated) */
178
mp4_support?: string;
179
}
180
181
interface Input {
182
/** URL to the input video file */
183
url: string;
184
/** Overlay settings */
185
overlay_settings?: object;
186
/** Generated subtitles configuration */
187
generated_subtitles?: Array<object>;
188
/** Start time for clipping */
189
start_time?: number;
190
/** End time for clipping */
191
end_time?: number;
192
/** Type of input ('video', 'audio', 'text') */
193
type?: string;
194
/** Text track type ('subtitles', 'captions') */
195
text_type?: string;
196
/** Language code */
197
language_code?: string;
198
/** Track name */
199
name?: string;
200
/** Closed captions flag */
201
closed_captions?: boolean;
202
/** Custom metadata */
203
passthrough?: string;
204
}
205
206
interface Asset {
207
/** Unique identifier */
208
id: string;
209
/** Creation timestamp (Unix epoch) */
210
created_at: string;
211
/** Asset status ('preparing', 'ready', 'errored') */
212
status: 'preparing' | 'ready' | 'errored';
213
/** Duration in seconds (max 12 hours) */
214
duration?: number;
215
/** Aspect ratio (e.g., '16:9') */
216
aspect_ratio?: string;
217
/** Maximum frame rate */
218
max_stored_frame_rate?: number;
219
/** Resolution tier ('audio-only', '720p', '1080p', '1440p', '2160p') */
220
resolution_tier?: string;
221
/** Video quality tier ('basic', 'plus', 'premium') */
222
video_quality?: string;
223
/** Maximum resolution setting */
224
max_resolution_tier?: string;
225
/** Master access setting */
226
master_access?: string;
227
/** Playback IDs */
228
playback_ids?: Array<PlaybackID>;
229
/** Media tracks */
230
tracks?: Array<Track>;
231
/** Error information if status is 'errored' */
232
errors?: {
233
type?: string;
234
messages?: Array<string>;
235
};
236
/** Static rendition status */
237
static_renditions?: {
238
status?: string;
239
files?: Array<object>;
240
};
241
/** Master file status and URL */
242
master?: {
243
status?: string;
244
url?: string;
245
};
246
/** Custom metadata */
247
passthrough?: string;
248
/** Structured metadata */
249
meta?: object;
250
/** Test asset flag */
251
test?: boolean;
252
/** Associated live stream ID */
253
live_stream_id?: string;
254
/** Live stream active flag */
255
is_live?: boolean;
256
/** Associated upload ID */
257
upload_id?: string;
258
/** Type of ingest */
259
ingest_type?: string;
260
/** Audio normalization setting */
261
normalize_audio?: boolean;
262
/** Live stream recording sessions */
263
recording_times?: Array<object>;
264
/** Source asset for clips */
265
source_asset_id?: string;
266
/** Non-standard input details */
267
non_standard_input_reasons?: object;
268
/** Ingest progress information */
269
progress?: {
270
/** Completion percentage (0-100) */
271
progress?: number;
272
/** State ('ingesting', 'transcoding', 'completed', 'live', 'errored') */
273
state?: string;
274
};
275
/** MP4 support (deprecated) */
276
mp4_support?: string;
277
/** Encoding tier (deprecated) */
278
encoding_tier?: string;
279
}
280
281
interface Track {
282
/** Track identifier */
283
id: string;
284
/** Track type ('video', 'audio', 'text') */
285
type: 'video' | 'audio' | 'text';
286
/** Track duration */
287
duration?: number;
288
/** Maximum width */
289
max_width?: number;
290
/** Maximum height */
291
max_height?: number;
292
/** Maximum frame rate */
293
max_frame_rate?: number;
294
/** Audio channels */
295
max_channels?: number;
296
/** Audio channel layout */
297
max_channel_layout?: string;
298
/** Text track type ('subtitles', 'captions') */
299
text_type?: 'subtitles' | 'captions';
300
/** Language code */
301
language_code?: string;
302
/** Track name */
303
name?: string;
304
/** Closed captions flag */
305
closed_captions?: boolean;
306
/** Custom metadata */
307
passthrough?: string;
308
/** Track status ('preparing', 'ready', 'errored') */
309
status?: string;
310
}
311
312
interface AssetCreateTrackParams {
313
/** URL to the track file */
314
url: string;
315
/** Track type ('text', 'audio', 'video') */
316
type: 'text' | 'audio' | 'video';
317
/** Text track type ('subtitles', 'captions') */
318
text_type?: 'subtitles' | 'captions';
319
/** Language code (e.g., 'en-US') */
320
language_code?: string;
321
/** Track name */
322
name?: string;
323
/** Closed captions flag */
324
closed_captions?: boolean;
325
/** Custom metadata */
326
passthrough?: string;
327
}
328
329
interface AssetGenerateSubtitlesParams {
330
/** Subtitle generation configurations */
331
generated_subtitles: Array<{
332
/** Target language */
333
language_code: string;
334
/** Subtitle track name */
335
name?: string;
336
/** Custom metadata */
337
passthrough?: string;
338
/** Custom vocabulary IDs */
339
transcription_vocabulary_ids?: Array<string>;
340
}>;
341
}
342
343
interface AssetCreateStaticRenditionParams {
344
/** Resolution tier ('highest', 'audio-only', '2160p', '1080p', '720p', etc.) */
345
resolution: string;
346
/** Rendition type ('standard', 'advanced') */
347
type?: 'standard' | 'advanced';
348
}
349
350
interface AssetUpdateMasterAccessParams {
351
/** Access setting ('temporary', 'none') */
352
master_access: 'temporary' | 'none';
353
}
354
355
interface AssetListParams {
356
/** Items per page */
357
limit?: number;
358
/** Page number */
359
page?: number;
360
/** Filter by live stream ID */
361
live_stream_id?: string;
362
/** Filter by upload ID */
363
upload_id?: string;
364
}
365
366
interface AssetUpdateParams {
367
/** Updated passthrough metadata */
368
passthrough?: string;
369
}
370
371
interface AssetCreatePlaybackIDParams {
372
/** Playback policy ('public', 'signed', 'drm') */
373
policy: PlaybackPolicy;
374
/** DRM config ID (required for 'drm' policy) */
375
drm_configuration_id?: string;
376
}
377
```
378
379
**Usage Example:**
380
381
```typescript
382
// Create an asset from URL
383
const asset = await client.video.assets.create({
384
inputs: [{ url: 'https://example.com/video.mp4' }],
385
playback_policies: ['public'],
386
video_quality: 'plus',
387
});
388
389
// Wait for asset to be ready
390
const readyAsset = await client.video.assets.retrieve(asset.id);
391
392
// Add subtitles
393
const track = await client.video.assets.createTrack(asset.id, {
394
url: 'https://example.com/subtitles.vtt',
395
type: 'text',
396
text_type: 'subtitles',
397
language_code: 'en',
398
});
399
```
400
401
### Live Streams
402
403
Manage live streaming sessions including creation, playback, simulcast targets, and subtitles.
404
405
```typescript { .api }
406
interface LiveStreams {
407
/**
408
* Create a new live stream
409
*/
410
create(body: LiveStreamCreateParams, options?: RequestOptions): Promise<LiveStream>;
411
412
/**
413
* Retrieve live stream details
414
*/
415
retrieve(liveStreamId: string, options?: RequestOptions): Promise<LiveStream>;
416
417
/**
418
* Update live stream parameters
419
*/
420
update(
421
liveStreamId: string,
422
body: LiveStreamUpdateParams,
423
options?: RequestOptions
424
): Promise<LiveStream>;
425
426
/**
427
* List all live streams
428
*/
429
list(query?: LiveStreamListParams, options?: RequestOptions): PagePromise<LiveStreamsBasePage, LiveStream>;
430
431
/**
432
* Delete a live stream (terminates active stream)
433
*/
434
delete(liveStreamId: string, options?: RequestOptions): Promise<void>;
435
436
/**
437
* End live stream recording immediately
438
*/
439
complete(liveStreamId: string, options?: RequestOptions): Promise<void>;
440
441
/**
442
* Create a playback ID for the live stream
443
*/
444
createPlaybackId(
445
liveStreamId: string,
446
body: LiveStreamCreatePlaybackIDParams,
447
options?: RequestOptions
448
): Promise<PlaybackID>;
449
450
/**
451
* Delete a playback ID from the live stream
452
*/
453
deletePlaybackId(
454
liveStreamId: string,
455
playbackId: string,
456
options?: RequestOptions
457
): Promise<void>;
458
459
/**
460
* Retrieve playback ID information
461
*/
462
retrievePlaybackId(
463
liveStreamId: string,
464
playbackId: string,
465
options?: RequestOptions
466
): Promise<PlaybackID>;
467
468
/**
469
* Create a simulcast target for the live stream
470
*/
471
createSimulcastTarget(
472
liveStreamId: string,
473
body: LiveStreamCreateSimulcastTargetParams,
474
options?: RequestOptions
475
): Promise<SimulcastTarget>;
476
477
/**
478
* Delete a simulcast target
479
*/
480
deleteSimulcastTarget(
481
liveStreamId: string,
482
simulcastTargetId: string,
483
options?: RequestOptions
484
): Promise<void>;
485
486
/**
487
* Retrieve simulcast target details
488
*/
489
retrieveSimulcastTarget(
490
liveStreamId: string,
491
simulcastTargetId: string,
492
options?: RequestOptions
493
): Promise<SimulcastTarget>;
494
495
/**
496
* Update embedded subtitle settings
497
*/
498
updateEmbeddedSubtitles(
499
liveStreamId: string,
500
body: LiveStreamUpdateEmbeddedSubtitlesParams,
501
options?: RequestOptions
502
): Promise<LiveStream>;
503
504
/**
505
* Update AI-generated subtitle settings
506
*/
507
updateGeneratedSubtitles(
508
liveStreamId: string,
509
body: LiveStreamUpdateGeneratedSubtitlesParams,
510
options?: RequestOptions
511
): Promise<LiveStream>;
512
513
/**
514
* Disable a live stream (prevents encoder connection)
515
*/
516
disable(liveStreamId: string, options?: RequestOptions): Promise<void>;
517
518
/**
519
* Enable a disabled live stream
520
*/
521
enable(liveStreamId: string, options?: RequestOptions): Promise<void>;
522
523
/**
524
* Generate a new stream key for the live stream
525
*/
526
resetStreamKey(liveStreamId: string, options?: RequestOptions): Promise<LiveStream>;
527
}
528
529
interface LiveStreamCreateParams {
530
/** Playback policies */
531
playback_policies?: Array<PlaybackPolicy>;
532
/** Settings for recorded assets */
533
new_asset_settings?: AssetOptions;
534
/** Seconds to wait for reconnection (default: 60, max: 1800) */
535
reconnect_window?: number;
536
/** Use slate during disconnections */
537
use_slate_for_standard_latency?: boolean;
538
/** Custom slate image URL */
539
reconnect_slate_url?: string;
540
/** Custom metadata */
541
passthrough?: string;
542
/** Latency mode ('low', 'reduced', 'standard') */
543
latency_mode?: 'low' | 'reduced' | 'standard';
544
/** Create test live stream */
545
test?: boolean;
546
/** Max duration in seconds (default: 43200) */
547
max_continuous_duration?: number;
548
/** Simulcast targets */
549
simulcast_targets?: Array<object>;
550
/** Embedded subtitle settings */
551
embedded_subtitles?: Array<object>;
552
/** AI subtitle generation settings */
553
generated_subtitles?: Array<object>;
554
/** Audio-only stream */
555
audio_only?: boolean;
556
/** Use low latency (deprecated) */
557
reduced_latency?: boolean;
558
}
559
560
interface AssetOptions {
561
/** Playback policies */
562
playback_policies?: Array<PlaybackPolicy>;
563
/** Video quality tier */
564
video_quality?: 'basic' | 'plus' | 'premium';
565
/** Master access setting */
566
master_access?: 'temporary' | 'none';
567
/** Maximum resolution tier */
568
max_resolution_tier?: '1080p' | '1440p' | '2160p';
569
/** Test asset flag */
570
test?: boolean;
571
/** Custom metadata */
572
passthrough?: string;
573
/** Normalize audio */
574
normalize_audio?: boolean;
575
/** Structured metadata */
576
meta?: object;
577
/** MP4 support (deprecated) */
578
mp4_support?: string;
579
}
580
581
interface LiveStream {
582
/** Unique identifier */
583
id: string;
584
/** Creation timestamp */
585
created_at: string;
586
/** RTMP stream key (keep secret) */
587
stream_key: string;
588
/** Current recording asset ID */
589
active_asset_id?: string;
590
/** Recent recording asset IDs */
591
recent_asset_ids?: Array<string>;
592
/** Stream status ('idle', 'active', 'disabled') */
593
status: 'idle' | 'active' | 'disabled';
594
/** Playback IDs */
595
playback_ids?: Array<PlaybackID>;
596
/** Recording asset settings */
597
new_asset_settings?: AssetOptions;
598
/** Custom metadata */
599
passthrough?: string;
600
/** Audio-only stream flag */
601
audio_only?: boolean;
602
/** Reconnection window in seconds */
603
reconnect_window?: number;
604
/** Slate usage flag */
605
use_slate_for_standard_latency?: boolean;
606
/** Custom slate URL */
607
reconnect_slate_url?: string;
608
/** Latency mode */
609
latency_mode?: string;
610
/** Max duration in seconds */
611
max_continuous_duration?: number;
612
/** Test stream flag */
613
test?: boolean;
614
/** Simulcast targets */
615
simulcast_targets?: Array<SimulcastTarget>;
616
/** Embedded subtitle configs */
617
embedded_subtitles?: Array<object>;
618
/** AI subtitle configs */
619
generated_subtitles?: Array<object>;
620
/** Low latency flag (deprecated) */
621
reduced_latency?: boolean;
622
}
623
624
interface SimulcastTarget {
625
/** Unique identifier */
626
id: string;
627
/** Target URL */
628
url: string;
629
/** Stream key */
630
stream_key?: string;
631
/** Custom metadata */
632
passthrough?: string;
633
/** Target status ('idle', 'starting', 'broadcasting', 'errored') */
634
status?: string;
635
/** Error severity level */
636
error_severity?: string;
637
}
638
639
interface LiveStreamCreateSimulcastTargetParams {
640
/** RTMP or RTMPS URL */
641
url: string;
642
/** Stream key for target */
643
stream_key?: string;
644
/** Custom metadata */
645
passthrough?: string;
646
}
647
648
interface LiveStreamUpdateParams {
649
/** Latency mode */
650
latency_mode?: 'low' | 'reduced' | 'standard';
651
/** Max duration in seconds */
652
max_continuous_duration?: number;
653
/** Reconnection window */
654
reconnect_window?: number;
655
/** Custom metadata */
656
passthrough?: string;
657
/** Asset settings */
658
new_asset_settings?: AssetOptions;
659
}
660
661
interface LiveStreamListParams {
662
/** Items per page */
663
limit?: number;
664
/** Page number */
665
page?: number;
666
/** Filter by stream key */
667
stream_key?: string;
668
}
669
670
interface LiveStreamCreatePlaybackIDParams {
671
/** Playback policy ('public', 'signed', 'drm') */
672
policy: PlaybackPolicy;
673
/** DRM config ID */
674
drm_configuration_id?: string;
675
}
676
```
677
678
**Usage Example:**
679
680
```typescript
681
// Create a live stream
682
const liveStream = await client.video.liveStreams.create({
683
playback_policies: ['public'],
684
new_asset_settings: {
685
playback_policies: ['public'],
686
},
687
latency_mode: 'low',
688
});
689
690
// Stream to: rtmps://global-live.mux.com:443/app
691
// Stream key: liveStream.stream_key
692
693
// Get playback URL
694
const playbackId = liveStream.playback_ids[0].id;
695
const hlsUrl = `https://stream.mux.com/${playbackId}.m3u8`;
696
697
// End the stream
698
await client.video.liveStreams.complete(liveStream.id);
699
```
700
701
### Direct Uploads
702
703
Manage direct upload URLs for client-side video uploads.
704
705
```typescript { .api }
706
interface Uploads {
707
/**
708
* Create a new direct upload URL
709
*/
710
create(body: UploadCreateParams, options?: RequestOptions): Promise<Upload>;
711
712
/**
713
* Retrieve upload details
714
*/
715
retrieve(uploadId: string, options?: RequestOptions): Promise<Upload>;
716
717
/**
718
* List all direct uploads
719
*/
720
list(query?: UploadListParams, options?: RequestOptions): PagePromise<UploadsBasePage, Upload>;
721
722
/**
723
* Cancel a pending direct upload
724
*/
725
cancel(uploadId: string, options?: RequestOptions): Promise<Upload>;
726
}
727
728
interface UploadCreateParams {
729
/** Origin for CORS headers (required for browser uploads) */
730
cors_origin?: string;
731
/** Asset creation settings */
732
new_asset_settings?: AssetOptions;
733
/** Create test upload */
734
test?: boolean;
735
/** Upload URL validity in seconds */
736
timeout?: number;
737
}
738
739
interface Upload {
740
/** Unique identifier */
741
id: string;
742
/** Upload URL (PUT your file here) */
743
url: string;
744
/** CORS origin */
745
cors_origin?: string;
746
/** Upload status ('waiting', 'asset_created', 'errored', 'cancelled', 'timed_out') */
747
status: string;
748
/** URL validity timeout in seconds */
749
timeout?: number;
750
/** Created asset ID (only set after upload) */
751
asset_id?: string;
752
/** Error details if status is 'errored' */
753
error?: object;
754
/** Asset creation settings */
755
new_asset_settings?: AssetOptions;
756
/** Test upload flag */
757
test?: boolean;
758
}
759
760
interface UploadListParams {
761
/** Items per page */
762
limit?: number;
763
/** Page number */
764
page?: number;
765
}
766
```
767
768
**Usage Example:**
769
770
```typescript
771
// Create upload URL
772
const upload = await client.video.uploads.create({
773
cors_origin: 'https://yoursite.com',
774
new_asset_settings: {
775
playback_policies: ['public'],
776
video_quality: 'basic',
777
},
778
});
779
780
// Client uploads video to upload.url via PUT request
781
782
// Poll upload status
783
const updatedUpload = await client.video.uploads.retrieve(upload.id);
784
if (updatedUpload.status === 'asset_created') {
785
const assetId = updatedUpload.asset_id;
786
}
787
```
788
789
### Playback IDs
790
791
Utilities for working with playback IDs.
792
793
```typescript { .api }
794
interface PlaybackIDs {
795
/**
796
* Get the asset or live stream associated with a playback ID
797
*/
798
retrieve(playbackId: string, options?: RequestOptions): Promise<PlaybackIDRetrieveResponse>;
799
}
800
801
interface PlaybackIDRetrieveResponse {
802
/** Playback ID */
803
id: string;
804
/** Playback policy */
805
policy: PlaybackPolicy;
806
/** Associated object */
807
object: {
808
/** Asset or live stream ID */
809
id: string;
810
/** Object type ('asset', 'live_stream') */
811
type: 'asset' | 'live_stream';
812
};
813
}
814
```
815
816
### Playback Restrictions
817
818
Manage playback access restrictions based on referrer and user agent.
819
820
```typescript { .api }
821
interface PlaybackRestrictions {
822
/**
823
* Create a new playback restriction
824
*/
825
create(body: PlaybackRestrictionCreateParams, options?: RequestOptions): Promise<PlaybackRestriction>;
826
827
/**
828
* Retrieve playback restriction details
829
*/
830
retrieve(playbackRestrictionId: string, options?: RequestOptions): Promise<PlaybackRestriction>;
831
832
/**
833
* List all playback restrictions
834
*/
835
list(query?: PlaybackRestrictionListParams, options?: RequestOptions): PagePromise<PlaybackRestrictionsBasePage, PlaybackRestriction>;
836
837
/**
838
* Delete a playback restriction
839
*/
840
delete(playbackRestrictionId: string, options?: RequestOptions): Promise<void>;
841
842
/**
843
* Update referrer domain restrictions
844
*/
845
updateReferrer(
846
playbackRestrictionId: string,
847
body: PlaybackRestrictionUpdateReferrerParams,
848
options?: RequestOptions
849
): Promise<PlaybackRestriction>;
850
851
/**
852
* Update user agent restrictions
853
*/
854
updateUserAgent(
855
playbackRestrictionId: string,
856
body: PlaybackRestrictionUpdateUserAgentParams,
857
options?: RequestOptions
858
): Promise<PlaybackRestriction>;
859
}
860
861
interface PlaybackRestrictionCreateParams {
862
/** Referrer domain restrictions */
863
referrer?: {
864
/** Allowed domains */
865
allowed_domains?: Array<string>;
866
/** Allow requests without referrer */
867
allow_no_referrer?: boolean;
868
};
869
/** User agent restrictions */
870
user_agent?: {
871
/** Allow requests without user agent */
872
allow_no_user_agent?: boolean;
873
/** Allow high-risk user agents */
874
allow_high_risk_user_agent?: boolean;
875
};
876
}
877
878
interface PlaybackRestriction {
879
/** Unique identifier */
880
id: string;
881
/** Creation timestamp */
882
created_at: string;
883
/** Referrer restrictions */
884
referrer?: object;
885
/** User agent restrictions */
886
user_agent?: object;
887
}
888
```
889
890
### Transcription Vocabularies
891
892
Manage custom vocabularies for improving transcription accuracy.
893
894
```typescript { .api }
895
interface TranscriptionVocabularies {
896
/**
897
* Create a custom transcription vocabulary
898
*/
899
create(body: TranscriptionVocabularyCreateParams, options?: RequestOptions): Promise<TranscriptionVocabulary>;
900
901
/**
902
* Retrieve vocabulary details
903
*/
904
retrieve(vocabularyId: string, options?: RequestOptions): Promise<TranscriptionVocabulary>;
905
906
/**
907
* Update vocabulary phrases
908
*/
909
update(
910
vocabularyId: string,
911
body: TranscriptionVocabularyUpdateParams,
912
options?: RequestOptions
913
): Promise<TranscriptionVocabulary>;
914
915
/**
916
* List all transcription vocabularies
917
*/
918
list(query?: TranscriptionVocabularyListParams, options?: RequestOptions): PagePromise<TranscriptionVocabulariesBasePage, TranscriptionVocabulary>;
919
920
/**
921
* Delete a transcription vocabulary
922
*/
923
delete(vocabularyId: string, options?: RequestOptions): Promise<void>;
924
}
925
926
interface TranscriptionVocabularyCreateParams {
927
/** Vocabulary name */
928
name: string;
929
/** Custom words/phrases */
930
phrases: Array<string>;
931
/** Custom metadata */
932
passthrough?: string;
933
}
934
935
interface TranscriptionVocabulary {
936
/** Unique identifier */
937
id: string;
938
/** Vocabulary name */
939
name: string;
940
/** Custom phrases */
941
phrases: Array<string>;
942
/** Custom metadata */
943
passthrough?: string;
944
/** Creation timestamp */
945
created_at: string;
946
/** Last update timestamp */
947
updated_at?: string;
948
}
949
950
interface TranscriptionVocabularyUpdateParams {
951
/** Updated name */
952
name?: string;
953
/** Updated phrases */
954
phrases?: Array<string>;
955
/** Updated metadata */
956
passthrough?: string;
957
}
958
```
959
960
### Web Inputs
961
962
Stream web content (URLs) as live video.
963
964
```typescript { .api }
965
interface WebInputs {
966
/**
967
* Create a new web input
968
*/
969
create(body: WebInputCreateParams, options?: RequestOptions): Promise<WebInputCreateResponse>;
970
971
/**
972
* Retrieve web input details
973
*/
974
retrieve(webInputId: string, options?: RequestOptions): Promise<WebInputRetrieveResponse>;
975
976
/**
977
* List all web inputs
978
*/
979
list(query?: WebInputListParams, options?: RequestOptions): PagePromise<WebInputListResponsesBasePage, WebInputListResponse>;
980
981
/**
982
* Delete a web input
983
*/
984
delete(webInputId: string, options?: RequestOptions): Promise<void>;
985
986
/**
987
* Start streaming a web input
988
*/
989
launch(webInputId: string, options?: RequestOptions): Promise<WebInputLaunchResponse>;
990
991
/**
992
* Reload the web page being streamed
993
*/
994
reload(webInputId: string, options?: RequestOptions): Promise<WebInputReloadResponse>;
995
996
/**
997
* Stop streaming a web input
998
*/
999
shutdown(webInputId: string, options?: RequestOptions): Promise<WebInputShutdownResponse>;
1000
1001
/**
1002
* Update the URL being streamed
1003
*/
1004
updateURL(
1005
webInputId: string,
1006
body: WebInputUpdateURLParams,
1007
options?: RequestOptions
1008
): Promise<WebInputUpdateURLResponse>;
1009
}
1010
1011
interface WebInputCreateParams {
1012
/** URL to stream */
1013
url: string;
1014
/** Automatically start streaming */
1015
auto_launch?: boolean;
1016
/** Target live stream ID */
1017
live_stream_id?: string;
1018
/** Timeout in seconds */
1019
timeout?: number;
1020
}
1021
```
1022
1023
### DRM Configurations
1024
1025
Manage DRM (Digital Rights Management) configurations.
1026
1027
```typescript { .api }
1028
interface DRMConfigurations {
1029
/**
1030
* Retrieve DRM configuration details
1031
*/
1032
retrieve(drmConfigurationId: string, options?: RequestOptions): Promise<DRMConfiguration>;
1033
1034
/**
1035
* List all DRM configurations
1036
*/
1037
list(query?: DRMConfigurationListParams, options?: RequestOptions): PagePromise<DRMConfigurationsBasePage, DRMConfiguration>;
1038
}
1039
1040
interface DRMConfiguration {
1041
/** Unique identifier for the DRM Configuration. Max 255 characters. */
1042
id: string;
1043
}
1044
```
1045
1046
### Playback Utilities
1047
1048
Playback utilities for thumbnails, storyboards, and metadata.
1049
1050
```typescript { .api }
1051
interface Playback {
1052
/**
1053
* Get HLS manifest URL
1054
*/
1055
hls(playbackId: string, params?: PlaybackHlsParams, options?: RequestOptions): string;
1056
1057
/**
1058
* Get thumbnail image URL
1059
*/
1060
thumbnail(playbackId: string, params?: PlaybackThumbnailParams, options?: RequestOptions): string;
1061
1062
/**
1063
* Get animated GIF URL
1064
*/
1065
animated(playbackId: string, params?: PlaybackAnimatedParams, options?: RequestOptions): string;
1066
1067
/**
1068
* Get storyboard image URL
1069
*/
1070
storyboard(playbackId: string, params?: PlaybackStoryboardParams, options?: RequestOptions): string;
1071
1072
/**
1073
* Get storyboard metadata
1074
*/
1075
storyboardMeta(playbackId: string, params?: PlaybackStoryboardMetaParams, options?: RequestOptions): Promise<PlaybackStoryboardMetaResponse>;
1076
1077
/**
1078
* Get storyboard VTT file
1079
*/
1080
storyboardVtt(playbackId: string, params?: PlaybackStoryboardVttParams, options?: RequestOptions): Promise<PlaybackStoryboardVttResponse>;
1081
1082
/**
1083
* Get track (subtitle/caption) file
1084
*/
1085
track(playbackId: string, params?: PlaybackTrackParams, options?: RequestOptions): Promise<PlaybackTrackResponse>;
1086
1087
/**
1088
* Get video transcript
1089
*/
1090
transcript(playbackId: string, params?: PlaybackTranscriptParams, options?: RequestOptions): Promise<PlaybackTranscriptResponse>;
1091
1092
/**
1093
* Get static rendition (MP4) URL
1094
*/
1095
staticRendition(playbackId: string, params?: PlaybackStaticRenditionParams, options?: RequestOptions): string;
1096
}
1097
1098
interface PlaybackHlsParams {
1099
/** JWT token for signed playback IDs */
1100
token?: string;
1101
/** DRM license token */
1102
drm_token?: string;
1103
}
1104
1105
interface PlaybackThumbnailParams {
1106
/** Time offset in seconds */
1107
time?: number;
1108
/** Image width */
1109
width?: number;
1110
/** Image height */
1111
height?: number;
1112
/** Fit mode ('preserve', 'stretch', 'crop', 'smartcrop') */
1113
fit_mode?: string;
1114
/** Flip vertically */
1115
flip_v?: boolean;
1116
/** Flip horizontally */
1117
flip_h?: boolean;
1118
/** JWT token for signed playback IDs */
1119
token?: string;
1120
}
1121
1122
interface PlaybackStaticRenditionParams {
1123
/** Static rendition ID */
1124
rendition_id: string;
1125
/** JWT token for signed playback IDs */
1126
token?: string;
1127
/** Filename for download */
1128
download?: string;
1129
}
1130
```
1131
1132
### Delivery Usage
1133
1134
Query video delivery usage data.
1135
1136
```typescript { .api }
1137
interface DeliveryUsage {
1138
/**
1139
* List delivery usage reports
1140
*/
1141
list(query?: DeliveryUsageListParams, options?: RequestOptions): PagePromise<DeliveryReportsPageWithTotal, DeliveryReport>;
1142
}
1143
1144
interface DeliveryUsageListParams {
1145
/** Filter by asset ID */
1146
asset_id?: string;
1147
/** Filter by live stream ID */
1148
live_stream_id?: string;
1149
/** Time range [start, end] */
1150
timeframe?: Array<string>;
1151
/** Items per page */
1152
limit?: number;
1153
/** Page number */
1154
page?: number;
1155
}
1156
1157
interface DeliveryReport {
1158
/** Asset identifier */
1159
asset_id?: string;
1160
/** Live stream identifier */
1161
live_stream_id?: string;
1162
/** Asset duration in seconds */
1163
asset_duration?: number;
1164
/** Total delivered seconds */
1165
delivered_seconds?: number;
1166
/** Breakdown by resolution tier */
1167
delivered_seconds_by_resolution?: object;
1168
}
1169
```
1170