aboutsummaryrefslogtreecommitdiff
path: root/source/client/index.ts
blob: ce3533fdb8b1f75b2178e9bb4548e010fa9486a6 (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
import { log } from "./logger"
import { Room } from "./room"

export const servers = {
    iceServers: [{ urls: ["stun:stun1.l.google.com:19302", "stun:stun2.l.google.com:19302"] }],
    iceCandidatePoolSize: 10,
}

export interface User {
    peer: RTCPeerConnection
    stream: MediaStream,
}

export const users: Map<string, User> = new Map()


window.onload = () => main()

export async function main() {
    if (window.location.pathname.startsWith("/room/")) {
        const room_name = window.location.pathname.substr("/room/".length)
        let room = new Room(room_name)
        document.body.append(room.el)
    } else {
        //TODO show ui for joining rooms
    }
}