Play and embed
Put a ready video in your application or publish a player link.
You will retrieve a playable URL, an iframe embed, and artwork for a ready video. These fields use your default active player domain, or an available shared player domain.
Retrieve playback details
curl --fail-with-body --request GET 'https://api.todayfiles.com/v1/videos/h87x' \
--header "Authorization: Bearer $TODAYFILES_API_KEY"const response = await fetch("https://api.todayfiles.com/v1/videos/h87x", {
method: "GET",
headers: {
Authorization: "Bearer " + process.env.TODAYFILES_API_KEY,
},
});
if (!response.ok) throw new Error(await response.text());
const result = response.status === 204 ? null : await response.json();
console.log(result);import json
import os
import requests
response = requests.request(
"GET", "https://api.todayfiles.com/v1/videos/h87x",
headers={
"Authorization": "Bearer " + os.environ["TODAYFILES_API_KEY"],
},
timeout=30,
)
response.raise_for_status()
print(response.json() if response.content else None)<?php
$client = curl_init("https://api.todayfiles.com/v1/videos/h87x");
curl_setopt_array($client, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('TODAYFILES_API_KEY'),
],
]);
$body = curl_exec($client);
if ($body === false) throw new RuntimeException(curl_error($client));
$status = curl_getinfo($client, CURLINFO_RESPONSE_CODE);
curl_close($client);
if ($status >= 400) throw new RuntimeException($body);
$result = $body === '' ? null : json_decode($body, true, 512, JSON_THROW_ON_ERROR);
print_r($result);package main
import (
"encoding/json"
"io"
"net/http"
"os"
"time"
)
func main() {
request, err := http.NewRequest("GET", "https://api.todayfiles.com/v1/videos/h87x", nil)
if err != nil { panic(err) }
request.Header.Set("Authorization", "Bearer " + os.Getenv("TODAYFILES_API_KEY"))
response, err := (&http.Client{Timeout: 30 * time.Second}).Do(request)
if err != nil { panic(err) }
defer response.Body.Close()
body, err := io.ReadAll(io.LimitReader(response.Body, 1 << 20))
if err != nil { panic(err) }
if response.StatusCode >= 400 { panic(string(body)) }
var result any
if len(body) > 0 {
if err := json.Unmarshal(body, &result); err != nil { panic(err) }
}
if err := json.NewEncoder(os.Stdout).Encode(result); err != nil { panic(err) }
}Wait for status to become ready. playback is null while a video waits for bytes or processes. If no player domain is available, player_url and embed_html are null even when processing is complete.
Embed the player
Use playback.embed_html in a responsive container. The returned HTML already names the video. Keep the iframe's fullscreen permission.
<div style="aspect-ratio:16/9">
<iframe src="https://todayfiles-play.site/h87x" title="Launch trailer"
width="100%" height="100%" frameborder="0" allowfullscreen></iframe>
</div>
The player URL also opens directly in a browser. A video id is the final segment of that URL; ids are accepted without regard to case and are returned in lower case.
Display artwork
Use playback.thumbnail_url for compact previews and playback.poster_url for a larger player cover. Either can be null while no artwork is available. The poster falls back to the thumbnail when a separate poster is unavailable. These are public, cacheable image URLs on the player domain.