blob: 502ab98a770b6c94e40cbff41cc56235a1fc09a4 (
plain)
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
|
/// <reference lib="dom" />
import { ediv } from "./helper.ts";
import { log } from "./logger.ts"
import { create_menu } from "./menu.ts";
import { SignalingConnection } from "./protocol/mod.ts";
import { Room } from "./room.ts"
export const BOTTOM_CONTAINER = ediv({ class: ["bottom-container"] })
export const ROOM_CONTAINER = ediv({ class: ["room"] })
export const RTC_CONFIG: RTCConfiguration = {
// google stun!?
iceServers: [{ urls: ["stun:stun1.l.google.com:19302", "stun:stun2.l.google.com:19302"] }],
iceCandidatePoolSize: 10,
}
export interface User {
peer: RTCPeerConnection
stream: MediaStream,
}
window.onload = () => main()
export async function main() {
document.body.querySelectorAll("p").forEach(e => e.remove())
log("*", "starting up")
const room_name = window.location.hash.substring(1)
if (room_name.length == 0) window.location.href = "/" // send them back to the start page
const conn = await (new SignalingConnection().connect(room_name))
new Room(conn)
create_menu()
document.body.append(ROOM_CONTAINER, BOTTOM_CONTAINER)
}
|