Skip to content
HLSStreamingVideo

Stream TeraBox Videos with HLS API — Embed in Any App

July 19, 2026 · 7 min read · By AR Digital Services

Every TeraBox API response includes a stream_url — an HLS (m3u8) link you can embed directly into any video player. This guide covers hls.js (browser), React Native, ffmpeg, and VLC.

What Is the HLS Stream URL?

When you call the TeraBox API, the response JSON includes a stream_url field — an HTTPS m3u8 manifest URL pointing to TeraBox's CDN. It's compatible with any HLS player.

// API response example
{
  "ok": true,
  "file_name": "lecture-01.mp4",
  "download_url": "https://cdn.terabox.com/file/...",
  "stream_url": "https://cdn.terabox.com/hls/123abc/index.m3u8",
  "size": 209715200,
  "thumbnail": "https://cdn.terabox.com/thumb/..."
}

Option 1 — Browser with hls.js

<!-- index.html -->
<video id="video" controls style="width:100%;max-width:800px"></video>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script>
  const streamUrl = "YOUR_STREAM_URL_FROM_API";
  const video = document.getElementById("video");

  if (Hls.isSupported()) {
    const hls = new Hls();
    hls.loadSource(streamUrl);
    hls.attachMedia(video);
    hls.on(Hls.Events.MANIFEST_PARSED, () => video.play());
  } else if (video.canPlayType("application/vnd.apple.mpegurl")) {
    // Safari native HLS support
    video.src = streamUrl;
    video.play();
  }
</script>

Option 2 — React with hls.js

import Hls from "hls.js";
import { useEffect, useRef } from "react";

export function TeraBoxPlayer({ streamUrl }: { streamUrl: string }) {
  const videoRef = useRef<HTMLVideoElement>(null);

  useEffect(() => {
    const video = videoRef.current;
    if (!video || !streamUrl) return;

    if (Hls.isSupported()) {
      const hls = new Hls();
      hls.loadSource(streamUrl);
      hls.attachMedia(video);
      return () => hls.destroy();
    } else {
      video.src = streamUrl;
    }
  }, [streamUrl]);

  return <video ref={videoRef} controls className="w-full rounded-xl" />;
}

Option 3 — ffmpeg (Download / Transcode)

# Download full video from HLS stream
ffmpeg -i "YOUR_STREAM_URL" -c copy output.mp4

# Transcode to lower quality
ffmpeg -i "YOUR_STREAM_URL" -vf scale=1280:720 -crf 23 output.mp4

Option 4 — React Native (expo-av)

import { Video, ResizeMode } from "expo-av";

<Video
  source={{ uri: streamUrl }}
  useNativeControls
  resizeMode={ResizeMode.CONTAIN}
  style={{ width: "100%", height: 220 }}
/>

Get the Stream URL — Full Flow

const res = await fetch("https://api.teraboxdl.site/v1/api", {
  method: "POST",
  headers: { "X-API-Key": "tbx_your_key" },
  body: JSON.stringify({ url: "https://terabox.com/s/..." }),
});
const data = await res.json();
const streamUrl = data.stream_url; // ← feed into any HLS player

Get Your TeraBox HLS API Key

Every plan includes HLS stream URLs. Start from ₹1,999/month.

Buy API Key →