Files
documentation/stream-api/overview/index.html

194 lines
8.7 KiB
HTML

<!doctype html>
<html lang="en" class="dark">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Stream API — Vyla</title>
<meta name="description" content="An optional self-hosted HTTP and SSE layer built on top of Vyla SDK." />
<meta name="keywords"
content="Stream API, HTTP API, SSE, Server-Sent Events, streaming API, self-hosted API, Node.js API" />
<link rel="canonical" href="https://vyla.cc/stream-api/overview.html" />
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:url" content="https://vyla.cc/stream-api/overview.html" />
<meta property="og:title" content="Stream API — Vyla" />
<meta property="og:description" content="An optional self-hosted HTTP and SSE layer built on top of Vyla SDK." />
<meta property="og:image" content="https://vyla.cc/assets/images/thumbnail.png" />
<meta property="og:site_name" content="Vyla" />
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="https://vyla.cc/stream-api/overview.html" />
<meta property="twitter:title" content="Stream API — Vyla" />
<meta property="twitter:description" content="An optional self-hosted HTTP and SSE layer built on top of Vyla SDK." />
<meta property="twitter:image" content="https://vyla.cc/assets/images/thumbnail.png" />
<meta property="twitter:site" content="@vylaentertainment" />
<!-- Additional SEO -->
<meta name="robots" content="index, follow" />
<meta name="author" content="Vyla" />
<link rel="icon" href="/favicon.ico" />
<link rel="stylesheet" href="/assets/base.css" />
<link rel="stylesheet" href="/assets/highlight.css" />
<link rel="stylesheet" href="/assets/mintlify-overrides.css" />
<!-- JSON-LD Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "Stream API",
"description": "An optional self-hosted HTTP and SSE layer built on top of Vyla SDK.",
"url": "https://vyla.cc/stream-api/overview.html",
"applicationCategory": "MultimediaApplication",
"operatingSystem": "Windows, macOS, Linux, Android, Android TV",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
}
}
</script>
</head>
<body>
<div id="banner">
<span>Vyla is self-hosted. Run Vyla Home, embed the SDK, or deploy Stream API on infrastructure you control. Rights
holders can request source removal — <a href="/misc/dmca">DMCA policy</a>.</span>
<button id="banner-close" onclick="dismissBanner()" aria-label="Dismiss">✕</button>
</div>
<header id="navbar">
<div class="nav-top">
<a class="brand" href="/"><img src="/assets/images/logo.png" alt="Vyla" id="brand-logo" loading="lazy"
fetchpriority="low"></a>
<button id="search-trigger" type="button" onclick="openSearch()" aria-label="Search"></button>
<div class="links">
<button id="theme-toggle" type="button" onclick="toggleThemeMenu(event)" aria-label="Theme"></button>
</div>
</div>
<nav class="tabs">
<a class="tab-link" href="/">Vyla</a>
<a class="tab-link" href="/sdk">SDK</a>
<a class="tab-link active" href="/stream-api/overview">Stream API</a>
<a class="tab-link" href="/guides/integrations">Resources</a>
<a class="tab-link" href="/misc/credit">Misc</a>
</nav>
</header>
<div id="layout">
<nav id="sidebar">
<div class="group">
<p class="group-title">Overview</p>
<ul>
<li><a class="active" href="/stream-api/overview">Overview</a></li>
</ul>
</div>
<div class="group">
<p class="group-title">Reference</p>
<ul>
<li><a class="" href="/stream-api/paths">Paths</a></li>
<li><a class="" href="/stream-api/media-data">Media Data</a></li>
<li><a class="" href="/stream-api/operations">Operations</a></li>
</ul>
</div>
<div class="group">
<p class="group-title">Deployment</p>
<ul>
<li><a class="" href="/self-hosting">Self Hosting</a></li>
</ul>
</div>
</nav>
<div id="content-col">
<main class="prose">
<h1>Stream API</h1>
<p class="page-description">An optional self-hosted HTTP and SSE layer built on top of Vyla SDK.</p>
<h2 id="use-this-only-when-http-is-the-right-boundary">Use this only when HTTP is the right boundary</h2>
<p>Stream API packages Vyla SDK behind a small Node.js HTTP service. It is useful when a browser, mobile app, or
another process needs progressive playback candidates over HTTP. It is not required to use Vyla, and it is not
the primary integration for a Node.js application—use <a href="/sdk">Vyla SDK</a> directly in that case.
</p>
<p>The service accepts TMDB IDs, asks configured SDK providers for candidates, verifies results, and emits
usable sources as they arrive. A player can start with the first source while retaining later sources as
fallbacks.</p>
<h2 id="what-it-provides">What it provides</h2>
<table>
<thead>
<tr>
<th>Capability</th>
<th>Endpoint family</th>
<th>Why it exists</th>
</tr>
</thead>
<tbody>
<tr>
<td>Progressive playback</td>
<td><code>/movie</code>, <code>/tv</code></td>
<td>Stream metadata and verified source candidates with SSE</td>
</tr>
<tr>
<td>Supplemental media</td>
<td><code>/subtitles</code>, <code>/downloads</code></td>
<td>Fetch tracks or downloadable candidates separately</td>
</tr>
<tr>
<td>Operations</td>
<td><code>/health</code>, <code>/test</code>, <code>/debug</code></td>
<td>Check source status and investigate a provider when permitted</td>
</tr>
</tbody>
</table>
<h2 id="start-a-local-instance">Start a local instance</h2>
<pre><code class="hljs language-bash">git <span class="hljs-built_in">clone</span> https://gitlab.com/vyla-entertainment/stream-api
<span class="hljs-built_in">cd</span> stream-api
npm install
TMDB_API_KEY=your_key
node server.js
</code></pre>
<p>The default local address is <code>http://localhost:7860</code>. For remote access, place the service behind
TLS and your own access controls. Full configuration is in <a href="/self-hosting">Self-hosting</a>.</p>
<h2 id="lifecycle-of-a-playback-request">Lifecycle of a playback request</h2>
<ol>
<li>A client opens <code>/movie?id=:tmdbId</code> or
<code>/tv?id=:tmdbId&#x26;season=:season&#x26;episode=:episode</code>.
</li>
<li>The API returns an SSE response and emits a <code>meta</code> event with title metadata and subtitle
tracks when available.</li>
<li>Active SDK providers resolve in parallel; verified results arrive as individual <code>source</code>
events.</li>
<li>The server sends <code>done</code> after all source attempts finish or time out.</li>
</ol>
<p>Start the player on the first source. Never wait for <code>done</code> before allowing playback, and always
retain a fallback queue. See <a href="/stream-api/paths">Paths and events</a> for the contract.</p>
<div class="callout callout-tip">
<div class="callout-content">
<p>If your application is already a Node.js service, call <code>VylaSDK#getStream</code>,
<code>getSubtitles</code>, and <code>getDownloads</code> directly. That removes an unnecessary network hop
and lets you define your own public API.
</p>
</div>
</div>
</main>
<aside id="toc">
<p class="toc-title">On this page</p>
<ul>
<li><a href="#use-this-only-when-http-is-the-right-boundary">Use this only when HTTP is the right boundary</a>
</li>
<li><a href="#what-it-provides">What it provides</a></li>
<li><a href="#start-a-local-instance">Start a local instance</a></li>
<li><a href="#lifecycle-of-a-playback-request">Lifecycle of a playback request</a></li>
</ul>
</aside>
</div>
</div>
<footer id="site-footer">
<a href="https://discord.gg/5eqRhKeywG" target="_blank" rel="noopener">Discord</a>
<a href="https://gitlab.com/vyla-entertainment/" target="_blank" rel="noopener">GitLab</a>
</footer>
<script src="/assets/app.js"></script>
</body>
</html>