Reference Source Test
import Mux from '@mux/mux-node'
public class | source

Mux

Extends:

* → Mux

Mux Class - Provides access to the Mux Video and Mux Data API

Example:

const muxClient = new Mux(accessToken, secret);
const { Video, Data, Webhooks } = muxClient;

// Create an asset
// returns a Promise
Video.Assets.create({input: 'https://storage.googleapis.com/muxdemofiles/mux-video-intro.mp4'})
  .then((data) => {
    assetId = data.id;
  });

// Create a playback Id for an asset
// returns a Promise
Video.Assets.createPlaybackId(assetId, { policy: 'public' });

// List all of the values across every breakdown for the `aggregate_startup_time` metric
// returns a Promise
Data.Metrics.breakdown('aggregate_startup_time', { group_by: 'browser' });

// Verify a webhook signature
Webhooks.verifyHeader(body, signature, secret);

Test:

Constructor Summary

Public Constructor
public

constructor(accessToken: string=process.env.MUX_TOKEN_ID, secret: string=process.env.MUX_TOKEN_SECRET, options: object)

Mux Constructor

Member Summary

Public Members
public
public

Public Constructors

public constructor(accessToken: string=process.env.MUX_TOKEN_ID, secret: string=process.env.MUX_TOKEN_SECRET, options: object) source

Mux Constructor

Params:

NameTypeAttributeDescription
accessToken string=process.env.MUX_TOKEN_ID

Mux API Access Token

secret string=process.env.MUX_TOKEN_SECRET

Mux API secret

options object

Optional configuration object

options.baseUrl string='https://api.mux.com'

Change the base URL for API requests.

Public Members