Uploads
Extends:
events~EventEmitter → src/base.js~Base → Uploads
Uploads Class - Provides access to the Mux Video Uploads API
Example:
const { Video } = new Mux(accessToken, secret);
// Create an upload
Video.Uploads.create({ new_asset_settings: { playback_policy: 'public' } });
Test:
Method Summary
Public Methods | ||
public |
Cancels an upload |
|
public |
Creates a direct upload with the specified JSON parameters |
|
public |
Get an upload |
|
public |
List all uploads |
Public Methods
public cancel(uploadId: string): Promise source
Cancels an upload
Params:
Name | Type | Attribute | Description |
uploadId | string | The ID for the upload intended for cancellation |
Example:
const { Video } = new Mux(accessToken, secret);
// Cancels an upload
Video.Uploads.cancel(uploadId);
public create(params: Object): Promise source
Creates a direct upload with the specified JSON parameters
Params:
Name | Type | Attribute | Description |
params | Object | Upload JSON parameters (e.g timeout) |
Example:
const muxClient = new Mux(accessToken, secret);
const { Video } = muxClient;
// Create a new upload
const upload = await Video.Uploads.create({new_asset_settings: {playback_policy: 'public'}});
// Now push a file to the URL returned.
fs.createReadStream(pathToFile).pipe(request.put(upload.url))
Test:
public get(uploadId: string): Promise source
Get an upload
Params:
Name | Type | Attribute | Description |
uploadId | string | The ID for the upload |
Example:
const { Video } = new Mux(accessToken, secret);
// Get an upload
Video.Uploads.get(uploadId);