Skip to content

Latest commit

 

History

History
83 lines (56 loc) · 5.58 KB

README.md

File metadata and controls

83 lines (56 loc) · 5.58 KB

Playback

(playback)

Overview

Operations related to playback api

Available Operations

  • get - Retrieve Playback Info

get

Retrieve Playback Info

Example Usage

import { Livepeer } from "livepeer";

const livepeer = new Livepeer({
  apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await livepeer.playback.get("<id>");
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { LivepeerCore } from "livepeer/core.js";
import { playbackGet } from "livepeer/funcs/playbackGet.js";

// Use `LivepeerCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const livepeer = new LivepeerCore({
  apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await playbackGet(livepeer, "<id>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
id string ✔️ The playback ID from the asset or livestream, e.g. eaw4nk06ts2d0mzb.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetPlaybackInfoResponse>

Errors

Error Object Status Code Content Type
errors.ErrorT 404 application/json
errors.SDKError 4xx-5xx /