Spaces:
Running

kheladekhboweb / temp_streams_docs.html
subrato1's picture
refactor: centralize channel resolution and UI updates
fb7ed3e
Raw History Blame Contribute Delete
26.7 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="../favicon.png" />
<link rel="preload" href="../fonts/inter/InterVariable.woff2" as="font" type="font/woff2" crossorigin />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script defer data-domain="streamed.su" src="https://a.cdn-lab.shop/js/script.js"></script>
<!--1dr7fwf--><!--[-1--><!--]--> <!--[-1--><!----><script>(function setInitialMode({ defaultMode, themeColors, darkClassNames = ["dark"], lightClassNames = [], defaultTheme = "" }) {
const rootEl = document.documentElement;
const mode = localStorage.getItem("mode-watcher-mode") || defaultMode;
const theme = localStorage.getItem("mode-watcher-theme") || defaultTheme;
const light = mode === "light" || mode === "system" && window.matchMedia("(prefers-color-scheme: light)").matches;
if (light) {
if (darkClassNames.length) rootEl.classList.remove(...darkClassNames);
if (lightClassNames.length) rootEl.classList.add(...lightClassNames);
} else {
if (lightClassNames.length) rootEl.classList.remove(...lightClassNames);
if (darkClassNames.length) rootEl.classList.add(...darkClassNames);
}
rootEl.style.colorScheme = light ? "light" : "dark";
if (themeColors) {
const themeMetaEl = document.querySelector("meta[name=\"theme-color\"]");
if (themeMetaEl) themeMetaEl.setAttribute("content", mode === "light" ? themeColors.light : themeColors.dark);
}
if (theme) {
rootEl.setAttribute("data-theme", theme);
localStorage.setItem("mode-watcher-theme", theme);
}
localStorage.setItem("mode-watcher-mode", mode);
})({"defaultMode":"dark","darkClassNames":["dark"],"lightClassNames":[],"defaultTheme":"","modeStorageKey":"mode-watcher-mode","themeStorageKey":"mode-watcher-theme"});</script><!----><!--]--><!----><!--dd4jme--><!----><style>pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#272822;color:#ddd}.hljs-tag,
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-strong,
.hljs-number,
.hljs-name{color:#f92672}.hljs-code{color:#66d9ef}.hljs-attribute,
.hljs-attr,
.hljs-symbol,
.hljs-regexp,
.hljs-link{color:#bf79db}.hljs-string,
.hljs-bullet,
.hljs-subst,
.hljs-title,
.hljs-section,
.hljs-emphasis,
.hljs-type,
.hljs-built_in,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-addition,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable{color:#a6e22e}.hljs-title.class_,
.hljs-class .hljs-title{color:white}.hljs-comment,
.hljs-quote,
.hljs-deletion,
.hljs-meta{color:#75715e}.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-doctag,
.hljs-title,
.hljs-section,
.hljs-type,
.hljs-selector-id{font-weight:bold}</style><!----> <meta name="description" content="Documentation for the Streamed Streams API endpoints"/><!----><title>Streamed - Streams API Documentation</title>
<link href="../_app/immutable/assets/dist.CJNePmAC.css" rel="stylesheet">
<link href="../_app/immutable/assets/0.B_Evpr83.css" rel="stylesheet">
<link href="../_app/immutable/assets/scroll-area.QE5ZuEV4.css" rel="stylesheet">
<link href="../_app/immutable/assets/SearchDrawer.Dfn3BCaV.css" rel="stylesheet">
<link href="../_app/immutable/assets/monokai.BOCB5FSt.css" rel="stylesheet">
</head>
<body>
<div style="display: contents"><!--[--><!--[0--><!--[--><!--[-1--><!--[-1--><!--]--> <div data-sveltekit-reload=""><!--[-1--><!--]--> <!----> <header class="sticky top-0 z-50 w-full border-b border-border/40 bg-background/95"><div class="container px-4 flex h-14 max-w-screen-2xl items-center"><div class="mr-4 hidden md:flex"><a href="/" class="mr-6 flex items-center space-x-2 relative"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide-icon lucide lucide-medal"><!--[--><!----><path d="M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15"><!----></path><!----><!----><path d="M11 12 5.12 2.2"><!----></path><!----><!----><path d="m13 12 5.88-9.8"><!----></path><!----><!----><path d="M8 7h8"><!----></path><!----><!----><circle cx="12" cy="17" r="5"><!----></circle><!----><!----><path d="M12 18v-2h-.5"><!----></path><!----><!--]--><!----><!----></svg><!----> <span class="hidden font-bold sm:inline-block">Streamed</span></a> <nav class="flex items-center gap-6 text-sm"><!--[--><!--[0--><a href="/" class="transition-colors hover:text-foreground/80 text-foreground/60">Home</a><!--]--><!--[0--><a href="/schedule" class="transition-colors hover:text-foreground/80 text-foreground/60">Schedule</a><!--]--><!--[0--><a href="/docs" class="transition-colors hover:text-foreground/80 text-foreground/60">API</a><!--]--><!--[0--><a href="https://status.strmd.link" class="transition-colors hover:text-foreground/80 text-foreground/60">Status</a><!--]--><!--]--> <!--[--><!--[--><!--[-1--><button class="text-left" id="bits-190859" aria-haspopup="dialog" aria-expanded="false" data-dialog-trigger="" data-state="closed"><span class="transition-colors hover:text-foreground/80 text-foreground/60">Feedback</span><!----><!----></button><!--]--><!--]--> <!--[--><!--[--><!--[-1--><!--]--><!--]--><!--]--><!----><!--]--><!----> <!--[-1--><!--[-1--><button class="cursor-pointer ring-offset-background focus-visible:ring-ring inline-flex items-center gap-2 whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border h-10 px-4 py-2 text-muted-foreground relative w-full justify-start text-sm sm:pr-12 md:w-40 lg:w-64" type="button"><span class="inline-flex">Search</span><!----></button><!--]--><!--]--></nav></div> <div class="flex flex-1 items-center space-x-2 md:justify-end"><a href="/multiview" class="hidden md:flex"><!--[-1--><button class="cursor-pointer ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border h-10 px-4 py-2" type="button"><!---->Multi Stream<!----></button><!--]--><!----></a> <div class="flex md:hidden space-x-2"><!--[--><!--[--><!--[-1--><button class="cursor-pointer ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border h-10 w-10" id="bits-190860" aria-haspopup="dialog" aria-expanded="false" data-dialog-trigger="" data-state="closed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide-icon lucide lucide-menu"><!--[--><!----><line x1="4" x2="20" y1="12" y2="12"><!----></line><!----><!----><line x1="4" x2="20" y1="6" y2="6"><!----></line><!----><!----><line x1="4" x2="20" y1="18" y2="18"><!----></line><!----><!--]--><!----><!----></svg><!----></button><!--]--><!--]--> <!--[--><!--[--><!--[-1--><!--]--><!--]--><!--]--><!----><!--]--> <!--[--><!--[--><!--[-1--><button class="cursor-pointer ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border h-10 w-10 p-2" id="bits-190861" aria-haspopup="dialog" aria-expanded="false" data-dialog-trigger="" data-state="closed"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide-icon lucide lucide-message-circle h-4 w-4"><!--[--><!----><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"><!----></path><!----><!--]--><!----><!----></svg><!----> <span class="sr-only">Send feedback</span><!----></button><!--]--><!--]--> <!--[--><!--[--><!--[-1--><!--]--><!--]--><!--]--><!----><!--]--><!----></div> <!--[-1--><!--[-1--><button class="cursor-pointer ring-offset-background focus-visible:ring-ring inline-flex items-center gap-2 whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border h-10 px-4 py-2 md:hidden text-muted-foreground relative w-full justify-start text-sm sm:pr-12 md:w-40 lg:w-64" type="button"><span class="hidden lg:inline-flex">Search</span> <span class="inline-flex lg:hidden">Search...</span><!----></button><!--]--><!--]--> <div class="flex space-x-2"><!--[0--><a class="cursor-pointer ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border h-10 w-10 p-2" href="https://discord.gg/KHC4xTYZgv"><svg fill="currentColor" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Discord</title><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"></path></svg><!----></a><!--]--><!----> <!--[--><!--[--><!--[-1--><button class="cursor-pointer ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border h-10 w-10" id="bits-190862" aria-haspopup="menu" aria-expanded="false" data-state="closed" data-dropdown-menu-trigger="" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide-icon lucide lucide-earth"><!--[--><!----><path d="M21.54 15H17a2 2 0 0 0-2 2v4.54"><!----></path><!----><!----><path d="M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17"><!----></path><!----><!----><path d="M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05"><!----></path><!----><!----><circle cx="12" cy="12" r="10"><!----></circle><!----><!--]--><!----><!----></svg><!----></button><!--]--><!----><!--]--> <!--[--><!--[--><!--[1--><!--[-1--><!--]--><!--]--><!--]--><!--]--><!----><!----><!--]--></div></div></div> <!--[-1--><!--]--></header><!----> <!--[-1--><!--]--><!----> <div class="px-4 md:px-24 pt-2 h-full w-full !display-block"><!--[0--><!--[--><div class="flex w-full justify-center"><div class="w-full md:w-5/6 h-auto flex flex-col md:flex-row gap-2"><div class="p-2 w-full md:w-1/6 border-border border-b-2 md:border-b-0 md:border-r-2 text-left md:text-right pr-6"><a href="/docs" class="text-2xl font-bold">API Documentation</a> <br/> <br/> <div class="flex flex-col gap-2"><!--[--><a href="/docs/matches" class="transition-colors text-xl hover:text-foreground/80 text-foreground/60">Matches</a><a href="/docs/streams" class="transition-colors text-xl hover:text-foreground/80 text-foreground">Streams</a><a href="/docs/sports" class="transition-colors text-xl hover:text-foreground/80 text-foreground/60">Sports</a><a href="/docs/images" class="transition-colors text-xl hover:text-foreground/80 text-foreground/60">Images</a><!--]--></div></div> <div class="p-2 h-full w-full md:w-5/6"><!--[--><h1 class="text-3xl font-bold">Streams API</h1> <div class="my-4"><p>The Streams API provides access to live streaming sources for sports events.
These endpoints return stream details that can be used to embed or access
video streams for matches.</p></div> <div class="my-6"><h2 class="text-2xl font-semibold mb-3">Stream Object Structure</h2> <!--[--><pre data-language="typescript" class="p-4 rounded-lg w-full border-border border svelte-167dipq"><code class="hljs"><!--[0--><!----><span class="hljs-keyword">interface</span> <span class="hljs-title class_">Stream</span> {
<span class="hljs-attr">id</span>: <span class="hljs-built_in">string</span>; <span class="hljs-comment">// Unique identifier for the stream</span>
<span class="hljs-attr">streamNo</span>: <span class="hljs-built_in">number</span>; <span class="hljs-comment">// Stream number/index</span>
<span class="hljs-attr">language</span>: <span class="hljs-built_in">string</span>; <span class="hljs-comment">// Stream language (e.g., &quot;English&quot;, &quot;Spanish&quot;)</span>
<span class="hljs-attr">hd</span>: <span class="hljs-built_in">boolean</span>; <span class="hljs-comment">// Whether the stream is in HD quality</span>
<span class="hljs-attr">embedUrl</span>: <span class="hljs-built_in">string</span>; <span class="hljs-comment">// URL that can be used to embed the stream</span>
<span class="hljs-attr">source</span>: <span class="hljs-built_in">string</span>; <span class="hljs-comment">// Source identifier (e.g., &quot;alpha&quot;, &quot;bravo&quot;)</span>
}<!----><!--]--></code></pre><!--]--><!----></div> <div class="my-6"><h2 class="text-2xl font-semibold mb-3">Available Endpoints</h2> <div class="space-y-4"><div class="p-4 border border-border rounded-lg"><h3 class="text-xl font-medium mb-2">Source-Specific Stream Endpoints</h3> <p class="mb-2">Get streams from a specific source for a match:</p> <table class="min-w-full mt-2 border-collapse"><thead><tr class="bg-primary/10"><th class="p-2 text-left">Source</th><th class="p-2 text-left">Endpoint</th></tr></thead><tbody><tr class="border-t border-border"><td class="p-2">Alpha</td><td class="p-2 font-mono text-sm">GET /api/stream/alpha/[id]</td></tr><tr class="border-t border-border"><td class="p-2">Bravo</td><td class="p-2 font-mono text-sm">GET /api/stream/bravo/[id]</td></tr><tr class="border-t border-border"><td class="p-2">Charlie</td><td class="p-2 font-mono text-sm">GET /api/stream/charlie/[id]</td></tr><tr class="border-t border-border"><td class="p-2">Delta</td><td class="p-2 font-mono text-sm">GET /api/stream/delta/[id]</td></tr><tr class="border-t border-border"><td class="p-2">Echo</td><td class="p-2 font-mono text-sm">GET /api/stream/echo/[id]</td></tr><tr class="border-t border-border"><td class="p-2">Foxtrot</td><td class="p-2 font-mono text-sm">GET /api/stream/foxtrot/[id]</td></tr><tr class="border-t border-border"><td class="p-2">Golf</td><td class="p-2 font-mono text-sm">GET /api/stream/golf/[id]</td></tr><tr class="border-t border-border"><td class="p-2">Hotel</td><td class="p-2 font-mono text-sm">GET /api/stream/hotel/[id]</td></tr><tr class="border-t border-border"><td class="p-2">Intel</td><td class="p-2 font-mono text-sm">GET /api/stream/intel/[id]</td></tr></tbody></table> <p class="mt-2 text-sm">Note: Replace [id] with the source-specific match ID from the match's sources array.</p></div></div></div> <div class="my-6"><h2 class="text-2xl font-semibold mb-3">How to Use</h2> <p class="mb-4">To access streams for a match:</p> <ol class="list-decimal ml-6 mb-4 space-y-1"><li>First, get a match object from the <a href="/docs/matches" class="underline">Matches API</a></li> <li>Extract the source and id from the match's sources array</li> <li>Use these values to request streams from the appropriate endpoint</li></ol></div> <div class="my-6"><h2 class="text-2xl font-semibold mb-3">Usage Example</h2> <!--[--><pre data-language="javascript" class="p-4 rounded-lg border-border border svelte-167dipq"><code class="hljs"><!--[0--><!----><span class="hljs-comment">// First, get match data to find available sources</span>
<span class="hljs-title function_">fetch</span>(<span class="hljs-string">&#x27;https://streamed.pk/api/matches/live&#x27;</span>)
.<span class="hljs-title function_">then</span>(<span class="hljs-function"><span class="hljs-params">response</span> =&gt;</span> response.<span class="hljs-title function_">json</span>())
.<span class="hljs-title function_">then</span>(<span class="hljs-function"><span class="hljs-params">matches</span> =&gt;</span> {
<span class="hljs-keyword">if</span> (matches.<span class="hljs-property">length</span> &gt; <span class="hljs-number">0</span>) {
<span class="hljs-comment">// Get the first match</span>
<span class="hljs-keyword">const</span> match = matches[<span class="hljs-number">0</span>];
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Found match: <span class="hljs-subst">${match.title}</span>`</span>);
<span class="hljs-comment">// Check if the match has sources</span>
<span class="hljs-keyword">if</span> (match.<span class="hljs-property">sources</span> &amp;&amp; match.<span class="hljs-property">sources</span>.<span class="hljs-property">length</span> &gt; <span class="hljs-number">0</span>) {
<span class="hljs-comment">// Get the first source</span>
<span class="hljs-keyword">const</span> source = match.<span class="hljs-property">sources</span>[<span class="hljs-number">0</span>];
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Using source: <span class="hljs-subst">${source.source}</span>, ID: <span class="hljs-subst">${source.id}</span>`</span>);
<span class="hljs-comment">// Request streams for this source</span>
<span class="hljs-keyword">return</span> <span class="hljs-title function_">fetch</span>(<span class="hljs-string">`https://streamed.pk/api/stream/<span class="hljs-subst">${source.source}</span>/<span class="hljs-subst">${source.id}</span>`</span>);
} <span class="hljs-keyword">else</span> {
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">Error</span>(<span class="hljs-string">&#x27;No sources available for this match&#x27;</span>);
}
} <span class="hljs-keyword">else</span> {
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">Error</span>(<span class="hljs-string">&#x27;No matches found&#x27;</span>);
}
})
.<span class="hljs-title function_">then</span>(<span class="hljs-function"><span class="hljs-params">response</span> =&gt;</span> response.<span class="hljs-title function_">json</span>())
.<span class="hljs-title function_">then</span>(<span class="hljs-function"><span class="hljs-params">streams</span> =&gt;</span> {
<span class="hljs-comment">// Process the streams</span>
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Found <span class="hljs-subst">${streams.length}</span> streams`</span>);
streams.<span class="hljs-title function_">forEach</span>(<span class="hljs-function"><span class="hljs-params">stream</span> =&gt;</span> {
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Stream #<span class="hljs-subst">${stream.streamNo}</span>: <span class="hljs-subst">${stream.language}</span> (<span class="hljs-subst">${stream.hd ? <span class="hljs-string">&#x27;HD&#x27;</span> : <span class="hljs-string">&#x27;SD&#x27;</span>}</span>)`</span>);
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`Embed URL: <span class="hljs-subst">${stream.embedUrl}</span>`</span>);
<span class="hljs-comment">// Here you would typically use the embedUrl to display the stream</span>
<span class="hljs-comment">// For example, in an iframe:</span>
<span class="hljs-comment">// document.getElementById(&#x27;player&#x27;).src = stream.embedUrl;</span>
});
})
.<span class="hljs-title function_">catch</span>(<span class="hljs-function"><span class="hljs-params">error</span> =&gt;</span> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">error</span>(<span class="hljs-string">&#x27;Error:&#x27;</span>, error));<!----><!--]--></code></pre><!--]--><!----></div> <div class="my-6"><h2 class="text-2xl font-semibold mb-3">Response Format</h2> <p class="mb-2">All endpoints return an array of stream objects:</p> <!--[--><pre data-language="javascript" class="p-4 rounded-lg border-border border svelte-167dipq"><code class="hljs"><!--[0--><!----><span class="hljs-comment">// Example response from /api/stream/alpha/match123</span>
[
{
<span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-string">&quot;stream_456&quot;</span>,
<span class="hljs-string">&quot;streamNo&quot;</span>: <span class="hljs-number">1</span>,
<span class="hljs-string">&quot;language&quot;</span>: <span class="hljs-string">&quot;English&quot;</span>,
<span class="hljs-string">&quot;hd&quot;</span>: <span class="hljs-literal">true</span>,
<span class="hljs-string">&quot;embedUrl&quot;</span>: <span class="hljs-string">&quot;https://embed.example.com/watch?v=abcd1234&quot;</span>,
<span class="hljs-string">&quot;source&quot;</span>: <span class="hljs-string">&quot;alpha&quot;</span>
},
{
<span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-string">&quot;stream_457&quot;</span>,
<span class="hljs-string">&quot;streamNo&quot;</span>: <span class="hljs-number">2</span>,
<span class="hljs-string">&quot;language&quot;</span>: <span class="hljs-string">&quot;Spanish&quot;</span>,
<span class="hljs-string">&quot;hd&quot;</span>: <span class="hljs-literal">false</span>,
<span class="hljs-string">&quot;embedUrl&quot;</span>: <span class="hljs-string">&quot;https://embed.example.com/watch?v=efgh5678&quot;</span>,
<span class="hljs-string">&quot;source&quot;</span>: <span class="hljs-string">&quot;alpha&quot;</span>
}
<span class="hljs-comment">// More stream objects...</span>
]<!----><!--]--></code></pre><!--]--><!----></div> <div class="my-6"><h2 class="text-2xl font-semibold mb-3">Embedding a Stream</h2> <p class="mb-2">To embed a stream in your website, use the embedUrl in an iframe:</p> <!--[--><pre data-language="javascript" class="p-4 rounded-lg border-border border svelte-167dipq"><code class="hljs"><!--[0--><!----><span class="hljs-comment">// HTML</span>
&lt;iframe
id=<span class="hljs-string">&quot;stream-player&quot;</span>
width=<span class="hljs-string">&quot;640&quot;</span>
height=<span class="hljs-string">&quot;360&quot;</span>
frameborder=<span class="hljs-string">&quot;0&quot;</span>
allowfullscreen&gt;
&lt;/iframe&gt;
<span class="hljs-comment">// JavaScript</span>
<span class="hljs-keyword">function</span> <span class="hljs-title function_">loadStream</span>(<span class="hljs-params">embedUrl</span>) {
<span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">&#x27;stream-player&#x27;</span>).<span class="hljs-property">src</span> = embedUrl;
}<!----><!--]--></code></pre><!--]--><!----></div> <p class="mt-4 mb-8"><a href="/docs" class="text-primary underline">← Back to API Documentation</a></p><!--]--><!----></div></div></div><!--]--><!--]--><!----></div></div><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]-->
<script>
{
__sveltekit_5yqj01 = {
base: new URL("..", location).pathname.slice(0, -1)
};
const element = document.currentScript.parentElement;
Promise.all([
import("../_app/immutable/entry/start.BvoAi2RL.js"),
import("../_app/immutable/entry/app.BqMhMZU6.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 3, 19],
data: [{type:"data",data:{user:null,ban:{content:"\u003Ca href=\"https://strmd.link\" class=\"underline animate-pulse font-bold\">Mirror Domains @ strmd.link\u003C/a>",active:true,type:"info"}},uses:{}},null,null],
form: null,
error: null
});
});
}
</script>
</div>
</body>
</html>