-
Notifications
You must be signed in to change notification settings - Fork 0
/
+page.svelte
51 lines (42 loc) · 818 Bytes
/
+page.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<script lang="ts">
import VideoRTC from '$lib/VideoRTC.svelte';
let stream_name = 'zed';
let error = '';
let mode = '';
let message = '';
let component: VideoRTC | null = null;
</script>
<h1>VideoRTC Component</h1>
<VideoRTC
bind:this={component}
src="http://localhost:1984/api/ws?src={stream_name}"
on:error={(e) => (error = e.detail)}
on:mode={(e) => (mode = e.detail)}
on:message={(e) => (message = e.detail)}
/>
{#if error}
<p>Error: {error}</p>
{/if}
{#if mode}
<p>Mode: {mode}</p>
{/if}
{#if message}
<p>Message: {JSON.stringify(message)}</p>
{/if}
{#if component}
<p>VideoRTC: {component}</p>
<button
on:click={() => {
component?.seekToEnd();
}}
>
Seek to end
</button>
<button
on:click={() => {
console.log(component?.getDelay());
}}
>
Get Delay
</button>
{/if}