DynTube API
  • Welcome!
  • Key Concepts
  • Quick Start
  • Reference
    • Videos
      • Video Upload via File (Server Side)
      • Video Upload via URL (server side)
      • HTML-Form Client Side Video Uploads
      • Get Video Status
      • Get Videos
      • Get Video
      • Update Video
      • Delete Video
      • Download Original Video
      • Get Video for Mobile App/Custom Player
      • Update Video Image
      • Add Video Captions/Chapters/Subtitles
      • Delete Video Captions/Subtitles/Chapters
      • Create Expirable Links
      • Get Collected Emails
      • Setting Up Webhooks
      • Copy call-to-action (CTA) to Videos
      • Token Authentication
    • Projects
      • Create Project
      • Update a Project
      • Get Projects
      • Get a Project
      • Delete a Project
      • Set default CTA for Project
    • Live Streaming
      • Create a Live Stream
      • Update a Live Stream
      • Get Live Streams
      • Get a Live Stream
      • Count Live Streams
      • Live Streams Limit
      • Get Live Streaming Recording
      • Delete a Live Stream
      • Service and Regions for live streams
    • Channels
      • Get Channels
      • Get Channel
      • Delete Channel
    • Subscriptions
      • Create a Plan
      • Create a Member
      • Attach Plan To Member
      • Get Plans
      • Get Members
      • Get Member's Plans
      • Delete a Plan
    • Analytics
      • Use your User Ids in Analytics
      • Get Video Analytics
    • Javascript Events Methods
      • Plain Javascript Events & Methods
      • Control the Player using React
      • Control the Player in Vue.js
    • Developer Resources
      • How to embed DynTube player in Next.Js
      • How to embed the video player in React
      • How to play DynTube videos in React Native
      • ExoPlayer app to play HLS videos
      • How to embed videos & channels dynamically
      • How to Import Vimeo Videos into DynTube
Powered by GitBook
On this page
  • Get a Single Video
  • This endpoint will return a single video with the provided video Id.
  • C# Sample
  • Node.js
  • Python
  • PHP
  1. Reference
  2. Videos

Get Video

API endpoint to fetch a single video

Our API to fetch videos is not optimized for real-time usage within a production environment.

To enhance the efficiency of your video retrieval process, we recommend that you fetch the video links using the API and store them in a database. By employing this method, you can seamlessly access your video links from the database and stream them as needed.

It is important to note that our video API is subject to a rate limit. Therefore, we strongly advise against using it for video retrieval immediately before playback within a production environment.

Get a Single Video

This endpoint will return a single video with the provided video Id.

GET https://api.dyntube.com/v1/videos/{id}

Path Parameters

Name
Type
Description

id*

String

Video Id. This is NOT the same as channelKey that is provided in the embed code. This is normally provided in the video list through API or through the dashboard.

{
    "id": "fFL56RU6PjvJPeE",
    "duration": "00:02:30.1270000",
    "projectId": "unjVhFJ7vAhrYu9",
    "accountKey": "6aG9UBe5rGPzjbh",
    "region": "use-s",
    "captions": [],
    "key": "NULPJ7mWDuyj4w5",
    "channelKey": "f8RMr2q4h6yNpv9",
    "privateLink": "QBr6n8HN878t5sH",
    "hlsLink": "Sx5FTtWsUU8tmux",
    "planType": 1,
    "mp4Url": "",
    "mp4Urls": [],
    "formats": {
        "hls": true,
        "mp4": false
    },
    "hlsUrl": "https://api.dyntube.com/v1/apps/hls/FhyinduNY4Kr9Q.m3u8",
    "hlsUrlWeb": "https://api.dyntube.com/v1/live/videos/EruJdgOPsbUg.m3u8",
    "title": "My Video",
    "description": "",
    "options": {
        "autoplay": false,
        "playerColor": "rgba(255, 65, 113, 0.83)",
        "playerSkin": "solid",
        "controlsColor": "#FFFFFF",
        "seekButtons": false,
        "volumeControl": true,
        "preload": "auto",
        "fullscreenControl": true,
        "controls": true,
        "stickyControls": false,
        "defaultQuality": "",
        "qualityControl": true,
        "speedControl": true,
        "fastForward": true,
        "bigPlayControl": true,
        "playControl": true,
        "volume": 1.0,
        "loop": false,
        "muted": false,
        "modal": false
    },
    "tags": [],
    "version": 1,
    "status": 3,
    "created": "2016-08-27T12:37:24.4970796+00:00"
}
{
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.4",
    "title": "Not Found",
    "status": 404,
    "traceId": "00-fc3d66e5001efa41d7ce56-c691caa6cf06b649-00"
}

C# Sample

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using System.Threading.Tasks;

namespace SingleVideo
{
    class Program
    {
        private static readonly HttpClient client = new HttpClient();

        static async Task Main(string[] args)
        {
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "your_bearer_token");

            var videoId = "your_video_id";
            var response = await client.GetAsync($"https://api.dyntube.com/v1/videos/{videoId}");

            if (response.IsSuccessStatusCode)
            {
                var responseContent = await response.Content.ReadAsStringAsync();
                var video = JsonSerializer.Deserialize<Video>(responseContent);

                Console.WriteLine("Id: " + video.Id);
                Console.WriteLine("Title: " + video.Title);
                Console.WriteLine("Description: " + video.Description);
                Console.WriteLine("hlsUrl: " + video.HlsUrl);
                Console.WriteLine("hlsUrlWeb: " + video.HlsUrlWeb);
                Console.WriteLine("mp4Url: " + video.Mp4Url);
            }
            else
            {
                Console.WriteLine("Error getting video. Status code: " + response.StatusCode);
            }
        }
    }

    class Video
    {
        public string Id { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public string HlsUrl { get; set; }
        public string HlsUrlWeb { get; set; }
        public string Mp4Url { get; set; }
    }
}

Node.js

const axios = require('axios');

const videoId = 'your_video_id';
const bearerToken = 'your_bearer_token';

async function getVideo() {
  try {
    const response = await axios.get(`https://api.dyntube.com/v1/videos/${videoId}`, {
      headers: {
        Authorization: `Bearer ${bearerToken}`
      }
    });
    const video = response.data;
    console.log('Id:', video.id);
    console.log('Title:', video.title);
    console.log('Description:', video.description);
    console.log('hlsUrl:', video.hlsUrl);
    console.log('hlsUrlWeb:', video.hlsUrlWeb);
    console.log('mp4Url:', video.mp4Url);
  } catch (error) {
    console.error(error);
  }
}

getVideo();

Python

import requests

video_id = 'your_video_id'
bearer_token = 'your_bearer_token'
url = f'https://api.dyntube.com/v1/videos/{video_id}'

headers = {
    'Authorization': f'Bearer {bearer_token}'
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    video = response.json()
    print('Id:', video['id'])
    print('Title:', video['title'])
    print('Description:', video['description'])
    print('hlsUrl:', video['hlsUrl'])
    print('hlsUrlWeb:', video['hlsUrlWeb'])
    print('mp4Url:', video['mp4Url'])
else:
    print('Error getting video. Status code:', response.status_code)

PHP

<?php
$video_id = 'your_video_id';
$bearer_token = 'your_bearer_token';
$url = "https://api.dyntube.com/v1/videos/{$video_id}";

$headers = array(
    'Authorization: Bearer ' . $bearer_token
);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

if (!$response) {
    echo 'Error getting video: ' . curl_error($ch);
} else {
    $video = json_decode($response, true);
    echo "Id: " . $video['id'] . "\n";
    echo "Title: " . $video['title'] . "\n";
    echo "Description: " . $video['description'] . "\n";
    echo "hlsUrl: " . $video['hlsUrl'] . "\n";
    echo "hlsUrlWeb: " . $video['hlsUrlWeb'] . "\n";
    echo "mp4Url: " . $video['mp4Url'] . "\n";
}

curl_close($ch);
?>
PreviousGet VideosNextUpdate Video

Last updated 1 year ago

A video status3 means that the video is published. .

See more details here