Fix up typescript issues
This commit is contained in:
parent
f050b15767
commit
e479a59171
1 changed files with 11 additions and 9 deletions
|
@ -1,17 +1,19 @@
|
|||
<script>
|
||||
let {stream, type} = $props();
|
||||
|
||||
const params = new URLSearchParams();
|
||||
let {stream = null, type = null} = $props();
|
||||
let src = $state(null);
|
||||
let data = $state(null);
|
||||
|
||||
switch (type) {
|
||||
case "twitch":
|
||||
data = { channel: stream, parent: window.location.host };
|
||||
src = "https://player.twitch.tv/?" + new URLSearchParams(data);
|
||||
params.set("channel", stream.toString());
|
||||
params.set("params", window.location.host.toString())
|
||||
src = "https://player.twitch.tv/?" + params;
|
||||
break;
|
||||
case "vdo":
|
||||
data = { view: stream, bitrate: 4000, proaudio: true };
|
||||
src = "https://vdo.ninja/?" + new URLSearchParams(data);
|
||||
params.set("view", stream.toString());
|
||||
params.set("bitrate", "4000");
|
||||
params.set("proaudio", "true");
|
||||
src = "https://vdo.ninja/?" + params;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -19,8 +21,8 @@
|
|||
</script>
|
||||
|
||||
<div class="stream-container">
|
||||
{#if src && data}
|
||||
<iframe title={stream} {src} allowfullscreen></iframe>
|
||||
{#if src}
|
||||
<iframe title={`${type} ${stream}`} {src} allowfullscreen></iframe>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue