GET
/
data
/
views
/
now
import { Livepeer } from "livepeer";

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

async function run() {
  const result = await livepeer.metrics.getRealtimeViewership();

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

run();
[
  {
    "playbackId": "1bde4o2i6xycudoy",
    "device": "iPhone",
    "browser": "Safari",
    "country": "United States",
    "viewCount": 100,
    "errorRate": 0.1
  }
]

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

playbackId
string

The playback ID to filter the query results. This can be a canonical playback ID from Livepeer assets or streams, or dStorage identifiers for assets

creatorId
string

The creator ID to filter the query results

breakdownBy[]
enum<string>[]

The list of fields to break down the query results. Specify this query-string multiple times to break down by multiple fields.

Available options:
playbackId,
device,
browser,
country

Response

200
application/json
A list of Metric objects
viewCount
integer
required

The number of views for the stream/asset.

errorRate
number
required

The error rate for the stream/asset.

playbackId
string

The playback ID associated with the metric.

device
string

The device used by the viewer.

browser
string

The browser used by the viewer.

country
string

The country where the viewer is located.