Live streaming

Get Live Streaming Recording

Introduction

When recording is enabled and a recording video is saved, DynTube associates the stream key as a video tag. Query the video list with that tag to find recording assets for the stream, then check each returned video's status and metadata before presenting it as a replay.

Video Retrieval URL

To fetch recorded videos for a live stream, you can use the following URL:

example
https://api.dyntube.com/v1/videos

Headers

Name / Type / Description
NameTypeDescription
AuthorizationStringBearer YOUR_API_KEY

Query Parameters

You can customize the retrieval process by using the following query parameters:

  • size: Specifies the number of videos to retrieve. Example: size=10 retrieves the latest 10 videos.
  • sort: Allows you to specify the sorting order for videos. Example: sort=Created:-1 retrieves videos in descending order of creation.
  • tags: This parameter should be set to the stream key to filter videos related to a specific stream. Example: tags=live_abc123

Multiple Video Files

A stream can have more than one recording video because of repeated broadcasts, reconnects, or recording segmentation. Process the complete videos array, retain each video ID, and use creation time and status to select or order replays.

Order and identify results

Sort by Created descending when the newest recording should appear first. Use the returned video ID and created value as stable application data; treat the title as editable display metadata rather than the only recording identifier.

Example

Here's an example URL to retrieve the latest 10 recorded videos for a specific stream:

example
https://api.dyntube.com/v1/videos?size=10&sort=Created:-1&tags=live_5a33165a8864b8244ad1

Code Sample (Node.js)

javascript
const axios = require('axios');

async function getRecordings(streamKey) {
  const res = await axios.get('https://api.dyntube.com/v1/videos', {
    params: {
      size: 10,
      sort: 'Created:-1',
      tags: streamKey
    },
    headers: { Authorization: 'Bearer YOUR_API_KEY' }
  });

  console.log(res.data);
}

getRecordings('live_5a33165a8864b8244ad1').catch(err => console.error(err.response?.data || err.message));

Code Sample (C#)

csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

var apiKey = "YOUR_API_KEY";
var streamKey = "live_5a33165a8864b8244ad1";

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);

var url = $"https://api.dyntube.com/v1/videos?size=10&sort=Created:-1&tags={Uri.EscapeDataString(streamKey)}";
var response = await client.GetAsync(url);
var body = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
    throw new Exception($"Request failed: {(int)response.StatusCode} {body}");
}

Console.WriteLine(body);

Code Sample (Python)

python
import requests

stream_key = "live_5a33165a8864b8244ad1"

response = requests.get(
    "https://api.dyntube.com/v1/videos",
    params={"size": 10, "sort": "Created:-1", "tags": stream_key},
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
response.raise_for_status()
print(response.json())

Code Sample (PHP)

php
<?php
$streamKey = 'live_5a33165a8864b8244ad1';
$query = http_build_query([
    'size' => 10,
    'sort' => 'Created:-1',
    'tags' => $streamKey,
]);

$ch = curl_init("https://api.dyntube.com/v1/videos?{$query}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY',
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode < 200 || $httpCode >= 300) {
    throw new Exception("Request failed with status {$httpCode}: {$response}");
}

echo $response;
  • Create a live stream to enable recording for new streams.
  • Get live streams to find stream metadata.
  • Get videos because recordings are returned as normal videos tagged with the stream key.
  • Setting up webhooks if you want event-driven recording workflows.

Something missing or wrong here? Tell us and we will correct it. New to DynTube? Start with uploading and embedding.