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>
|
<script>
|
||||||
let {stream, type} = $props();
|
const params = new URLSearchParams();
|
||||||
|
let {stream = null, type = null} = $props();
|
||||||
let src = $state(null);
|
let src = $state(null);
|
||||||
let data = $state(null);
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "twitch":
|
case "twitch":
|
||||||
data = { channel: stream, parent: window.location.host };
|
params.set("channel", stream.toString());
|
||||||
src = "https://player.twitch.tv/?" + new URLSearchParams(data);
|
params.set("params", window.location.host.toString())
|
||||||
|
src = "https://player.twitch.tv/?" + params;
|
||||||
break;
|
break;
|
||||||
case "vdo":
|
case "vdo":
|
||||||
data = { view: stream, bitrate: 4000, proaudio: true };
|
params.set("view", stream.toString());
|
||||||
src = "https://vdo.ninja/?" + new URLSearchParams(data);
|
params.set("bitrate", "4000");
|
||||||
|
params.set("proaudio", "true");
|
||||||
|
src = "https://vdo.ninja/?" + params;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -19,8 +21,8 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="stream-container">
|
<div class="stream-container">
|
||||||
{#if src && data}
|
{#if src}
|
||||||
<iframe title={stream} {src} allowfullscreen></iframe>
|
<iframe title={`${type} ${stream}`} {src} allowfullscreen></iframe>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue