Mux v1.9.0 Mux.Token View Source

This module provides helpers for working with Playback IDs with signed playback policies. API Documentation

Link to this section Summary

Functions

Create a signed URL token for a playback ID.

Link to this section Types

Link to this type

option()

View Source
option() ::
  {:type, signature_type()}
  | {:expiration, integer()}
  | {:token_id, String.t()}
  | {:token_secret, String.t()}
  | {:params, any()}
Link to this type

options()

View Source
options() :: [option()]
Link to this type

signature_type()

View Source
signature_type() :: :video | :thumbnail | :gif

Link to this section Functions

Link to this function

sign(playback_id, opts \\ [])

View Source
sign(String.t(), options()) :: String.t()

Create a signed URL token for a playback ID.

options object can include:

  • options.token_id: Signing token ID (defaults to Application.get_env(:mux, :signing_token_id))
  • options.token_secret: Signing token secret (defaults to Application.get_env(:mux, :signing_token_secret))
  • options.type: Type of signature to create. Defaults to :video, options are: :video, :gif, :thumbnail
  • options.expiration: Seconds the token is valid for. Defaults to 7 days from now (604,800)
  • options.params: Map that includes any additional query params. For thumbnails this would be values like height or time.
Link to this function

verify(token, opts \\ [])

View Source