From 4475fb02925c04ba19cb9ec8b99110e4e74c3acb Mon Sep 17 00:00:00 2001 From: MetaMuffin Date: Thu, 5 Aug 2021 11:00:46 +0200 Subject: updated licence, added all the code --- source/client/index.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'source/client/index.ts') diff --git a/source/client/index.ts b/source/client/index.ts index 87421f2..31c8b1f 100644 --- a/source/client/index.ts +++ b/source/client/index.ts @@ -1,3 +1,4 @@ +import { log } from "./logger" import { Room } from "./room" export const servers = { @@ -13,7 +14,13 @@ export interface User { export const users: Map = new Map() -window.onload = async () => { +window.onload = () => main() + +export var local_media: MediaStream + + +export async function main() { + await init_local_media() if (window.location.pathname.startsWith("/room/")) { const room_name = window.location.pathname.substr("/room/".length) let room = new Room(room_name) @@ -23,6 +30,13 @@ window.onload = async () => { } } +export async function init_local_media() { + log("media", "requesting user media") + local_media = await navigator.mediaDevices.getUserMedia({ audio: true, video: true }) + log("media", `got ${local_media.getTracks().length} local streams"`, local_media.getTracks()) +} + + // async function setup_webrtc() { -- cgit v1.2.3-70-g09d2