beta/
docs
/
overview
OverviewGuidesAPI Reference
Log inSign up
beta/
docs
/
overview
OverviewGuidesAPI Reference
Sign upLogin
Guides
Getting started with Livepeer.com
Live stream with the Livepeer.com API
Overview
Track stream usage and duration
Live stream with the Livepeer.com dashboard
Your Livepeer.com account

How to track stream usage and duration

If you are operating a live-streaming or user generated content platform, you will want to know the the total duration of the "parent" stream object and the duration of a "child" stream session.

GET /stream/{id} to retrieve a stream object or a session stream object

Stream sessions are a type of stream object. Use the same GET /stream/{id} request to retieve any type of stream object, whether it be a parent object or a child-session object.

curl -H 'authorization: Bearer {api-key}' \
"https://livepeer.com/api/stream/{id}"

sourceSegmentsDuration

The value of sourceSegmentsDuration returned is the duration in seconds of the asset source processed by Livepeer.com. On the parent object, this value equates to the total amount of source video ingested by Livepeer.com all time. On the child-session object, this value is the length of the live stream session (and session recording). Learn more about the stream object in the API reference.

{
"id":"yyyyyyyy-yyyy-yyyy-yyyy-yyyy",
"parentId":"nnnnnnnn-nnnn-nnnn-nnnn-nnnn",
"kind":"stream",
"name":"test_stream",
"userId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxx",
"createdAt":1595721600,
"streamKey":"zzzz-zzzz-zzzz-zzzz",
"playbackId":"xyz123xyz123",
"createdByTokenName":"test-api-key",
"sourceSegments":1360,
"transcodedSegments":5480,
"sourceSegmentsDuration":2630.53200000000004,
"transcodedSegmentsDuration":10620.1280000000004
{other asset object keys, like profiles}
}

Next, learn Next, learn how to list all stream objects.

Livepeer.com
beta
  • Company
  • Home
  • Contact
  • Team
  • Jobs
  • Livepeer, Inc.
  • 223 Bedford Ave PMB 530
    Brooklyn, NY 11211
  • [email protected]