Skip to Content

Overview

Instead of waiting for a full video to render and download, HLS streaming lets you start playing the video as it is rendered. Frames are progressively written to an HLS playlist that a standard <video> player can consume.

This is useful for:

  • Interactive video experiences where low latency matters
  • Long videos where you don’t want to wait for full render completion
  • Integration with video players that natively support HLS (Video.js, hls.js, Safari)

Initiate a streaming session

POST /api/video-streaming/
curl -X POST https://api.oshara.ai/api/video-streaming/ \ -H "Authorization: Bearer <token>" \ -F "title=Live Demo" \ -F "text_content=Hello and welcome..." \ -F "avatar=@/path/to/avatar.jpg" \ -F "reference_audio=@/path/to/voice.wav"

Request fields

Same as Video Jobs.

Response

{ "session_id": "stream-abc123", "playlist_url": "https://api.oshara.ai/api/hls/stream-abc123/playlist.m3u8", "status": "PROCESSING" }
FieldDescription
session_idUnique identifier for this streaming session.
playlist_urlHLS playlist URL — point your video player here.
status"PROCESSING" — the playlist is live as soon as this response arrives.

Fetch the HLS playlist

GET /api/hls/{session_id}/playlist.m3u8

Returns a standard HLS manifest. Segments are appended as rendering progresses. The playlist ends with #EXT-X-ENDLIST once the full video is rendered.

curl https://api.oshara.ai/api/hls/stream-abc123/playlist.m3u8

Playing in a browser

Native <video> (Safari / iOS)

Safari supports HLS natively:

<video controls autoplay> <source src="https://api.oshara.ai/api/hls/stream-abc123/playlist.m3u8" type="application/x-mpegURL" /> </video>

hls.js (Chrome, Firefox, Edge)

<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script> <video id="video" controls autoplay></video> <script> const src = "https://api.oshara.ai/api/hls/stream-abc123/playlist.m3u8"; const video = document.getElementById("video"); if (Hls.isSupported()) { const hls = new Hls(); hls.loadSource(src); hls.attachMedia(video); } else if (video.canPlayType("application/vnd.apple.mpegurl")) { video.src = src; } </script>

Video.js

import videojs from "video.js"; const player = videojs("video-player", { sources: [{ src: "https://api.oshara.ai/api/hls/stream-abc123/playlist.m3u8", type: "application/x-mpegURL" }] });

Notes

  • The first segment is usually available within 2–5 seconds of initiating the session.
  • Seek-back into already-rendered segments is supported; seek-forward into not-yet-rendered segments will stall and resume automatically.
  • Streaming sessions expire 24 hours after the session ends. Download the final video from the corresponding job’s processed_video_url for permanent storage.
Last updated on