Assets
Extends:
Assets Class - Provides access to the Mux Video Assets API
Example:
const { Video } = new Mux(accessToken, secret);
// Create an asset
Video.Assets.create({input: 'https://storage.googleapis.com/muxdemofiles/mux-video-intro.mp4'});
Method Summary
Public Methods | ||
public |
Creates a Mux asset with the specified JSON parameters |
|
public |
createPlaybackId(assetId: string, params: Object): Promise Create an asset playback id |
|
public |
createTrack(assetId: string, params: Object): Promise Create a subtitle text track |
|
public |
Deletes a Mux asset |
|
public |
deletePlaybackId(assetId: string, playbackId: string): Promise Delete an asset playback ID |
|
public |
deleteTrack(assetId: string, trackId: string): Promise Delete an asset text track |
|
public |
Get an asset |
|
public |
Get input info for an asset |
|
public |
List all assets for a Mux Environment (tied to your access token) |
|
public |
playbackId(assetId: string, playbackId: string): Promise Return an asset playback id |
|
public |
updateMasterAccess(params: Object): Promise Update master access for an asset |
|
public |
updateMp4Support(params: Object): Promise Update mp4 support for an asset |
Public Methods
public create(params: Object): Promise source
Creates a Mux asset with the specified JSON parameters
Params:
Name | Type | Attribute | Description |
params | Object | Asset JSON parameters (e.g input) |
Example:
const { Video } = new Mux(accessToken, secret);
// Create an asset
Video.Assets.create({input: 'https://storage.googleapis.com/muxdemofiles/mux-video-intro.mp4'});
Test:
public createPlaybackId(assetId: string, params: Object): Promise source
Create an asset playback id
Example:
const { Video } = new Mux(accessToken, secret);
// Create an asset playback ID
Video.Assets.createPlaybackId(assetId, { policy: 'public' });
public createTrack(assetId: string, params: Object): Promise source
Create a subtitle text track
Example:
const { Video } = new Mux(accessToken, secret);
// Create an asset text track
Video.Assets.createTrack(assetId, {
url: "https://example.com/myVIdeo_en.srt",
type: "text",
text_type: "subtitles",
language_code: "en-US",
});
Test:
public del(assetId: string): Promise source
Deletes a Mux asset
Params:
Name | Type | Attribute | Description |
assetId | string | The ID for the asset intended for deletion |
Example:
const { Video } = new Mux(accessToken, secret);
// Delete an asset
Video.Assets.del(assetId);
public deletePlaybackId(assetId: string, playbackId: string): Promise source
Delete an asset playback ID
Example:
const { Video } = new Mux(accessToken, secret);
// Delete an asset playback ID
Video.Assets.deletePlaybackId(assetId, { policy: 'public' });
Test:
public deleteTrack(assetId: string, trackId: string): Promise source
Delete an asset text track
Example:
const { Video } = new Mux(accessToken, secret);
// Delete an asset text track
Video.Assets.deleteTrack(assetId, trackId);
Test:
public get(assetId: string): Promise source
Get an asset
Params:
Name | Type | Attribute | Description |
assetId | string | The ID for the asset |
Example:
const { Video } = new Mux(accessToken, secret);
// Get an asset
Video.Assets.get(assetId);
public inputInfo(assetId: string): Promise source
Get input info for an asset
Params:
Name | Type | Attribute | Description |
assetId | string | The ID for the asset |
Example:
const { Video } = new Mux(accessToken, secret);
// Get input info for an asset
Video.Assets.inputInfo(assetId);
Test:
public list(params: *): Promise source
List all assets for a Mux Environment (tied to your access token)
Params:
Name | Type | Attribute | Description |
params | * |
Example:
const { Video } = new Mux(accessToken, secret);
// List all assets for a Mux Environment
Video.Assets.list();
Test:
public playbackId(assetId: string, playbackId: string): Promise source
Return an asset playback id
Example:
const { Video } = new Mux(accessToken, secret);
// Retrieve an asset playbackId
Video.Assets.playbackId(assetId, playbackId);
Test:
public updateMasterAccess(params: Object): Promise source
Update master access for an asset
Params:
Name | Type | Attribute | Description |
params | Object | master access JSON parameters |
Example:
const { Video } = new Mux(accessToken, secret);
// Update master access for an asset
Video.Assets.updateMasterAccess(assetId, {master_access: "temporary"});
public updateMp4Support(params: Object): Promise source
Update mp4 support for an asset
Params:
Name | Type | Attribute | Description |
params | Object | mp4 support JSON parameters |
Example:
const { Video } = new Mux(accessToken, secret);
// Updates mp4 support for an asset
Video.Assets.updateMp4Support(assetId, {mp4_support: "standard"});