Code Examples & Integration
Integrate StreamVault into your application with the REST API, embed codes, and direct HLS playback.
JavaScript
Node.js & browser SDK
Coming soonReact
React component library
Coming soonPython
Python SDK
Coming soonOfficial client packages are in the works. In the meantime, the REST API works from any language with an HTTP client — the examples below cover JavaScript and Python without any dependency beyond what ships with your runtime.
JavaScript
Works in Node.js 18+ and every modern browser using the built-in fetch. Keep your API key server-side — never ship it in browser code.
const BASE = 'https://api.streamvault.one/v1';
const headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
};
// List videos
const { videos } = await fetch(`${BASE}/videos`, { headers }).then(r => r.json());
// Get a single video
const video = await fetch(`${BASE}/videos/VIDEO_ID`, { headers }).then(r => r.json());
console.log(video.title, video.iframeLink);
// Upload via URL
const uploaded = await fetch(`${BASE}/videos`, {
method: 'POST',
headers,
body: JSON.stringify({
url: 'https://example.com/video.mp4',
title: 'My Video',
}),
}).then(r => r.json());
// Update a video
await fetch(`${BASE}/videos/VIDEO_ID`, {
method: 'PATCH',
headers,
body: JSON.stringify({ title: 'Updated Title' }),
});
// Poll encoding status after upload
const status = await fetch(`${BASE}/videos/VIDEO_ID/status`, { headers }).then(r => r.json());
// Delete a video
await fetch(`${BASE}/videos/VIDEO_ID`, { method: 'DELETE', headers });Python
Using the requests library (pip install requests):
import requests
BASE = "https://api.streamvault.one/v1"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
# List videos
videos = requests.get(f"{BASE}/videos", headers=HEADERS).json()
for video in videos["videos"]:
print(video["title"], video["status"])
# Upload via URL
video = requests.post(
f"{BASE}/videos",
headers=HEADERS,
json={"url": "https://example.com/video.mp4", "title": "My Video"},
).json()
# Poll encoding status
status = requests.get(f"{BASE}/videos/{video['id']}/status", headers=HEADERS).json()
print(status)
# Delete a video
requests.delete(f"{BASE}/videos/{video['id']}", headers=HEADERS)Embed Codes
Every video's embed code is also available in the dashboard under the video's Embed Code option — including your verified custom domain when one is connected.
Standard iframe Embed
<iframe src="https://streamvault.one/embed/VIDEO_ID" width="640" height="360" frameborder="0" allow="encrypted-media; fullscreen; picture-in-picture" allowfullscreen> </iframe>
Responsive Embed
<div style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
<iframe
src="https://streamvault.one/embed/VIDEO_ID"
style="position:absolute;top:0;left:0;width:100%;height:100%;"
frameborder="0"
allow="encrypted-media; fullscreen; picture-in-picture"
allowfullscreen>
</iframe>
</div>HLS Direct Playback
For native apps or a fully custom player, load the HLS manifest directly. Safari plays HLS natively; other browsers can use hls.js:
// Using hls.js for direct HLS playback
import Hls from 'hls.js';
const video = document.getElementById('video');
const hls = new Hls();
hls.loadSource('https://api.streamvault.one/v1/play/VIDEO_ID/master.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, () => {
video.play();
});A mobile-friendly manifest URL is also available per video in the dashboard (/v1/apps/hls/{key}.m3u8). Note: domain allowlists and access rules configured for the video apply to manifest requests as well.
Embedding in your LMS
The responsive iframe above works in every major course platform. Platform notes:
WordPress
Add a Custom HTML block and paste the responsive embed. With LearnDash/LifterLMS, paste into the lesson content field. Add your site's domain to the video's domain whitelist.
Teachable
In the lesson editor choose Add HTML and paste the embed. Whitelist your school's domain (yourschool.teachable.com and your custom domain).
Thinkific
Use a Text lesson → source/HTML view → paste the embed. Whitelist your .thinkific.com and custom domains.
Kajabi
Add a Custom Code block in the lesson and paste the embed. Whitelist your kajabi-provided and custom domains.
Moodle
In the HTML editor toggle source mode (< >) and paste the embed. Whitelist your Moodle domain.
Tip: set the whitelist at the project level so every lesson video inherits it — and your embeds simply refuse to play anywhere else.