diff options
author | MetaMuffin <metamuffin@yandex.com> | 2021-08-06 10:00:48 +0200 |
---|---|---|
committer | MetaMuffin <metamuffin@yandex.com> | 2021-08-06 10:00:48 +0200 |
commit | 2387d8910d80b86a95e8c3242bdb6809dddda1aa (patch) | |
tree | c30cc11040534d4893f163e261a0c54f53fabadf /source/client/user.ts | |
parent | 57785600bb67dc1163945bd19ff3bbb9f0aab0c2 (diff) | |
download | keks-meet-2387d8910d80b86a95e8c3242bdb6809dddda1aa.tar keks-meet-2387d8910d80b86a95e8c3242bdb6809dddda1aa.tar.bz2 keks-meet-2387d8910d80b86a95e8c3242bdb6809dddda1aa.tar.zst |
works somewhat
Diffstat (limited to 'source/client/user.ts')
-rw-r--r-- | source/client/user.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/client/user.ts b/source/client/user.ts index b7ee24a..7d6991a 100644 --- a/source/client/user.ts +++ b/source/client/user.ts @@ -1,3 +1,4 @@ +import { log } from "./logger" import { Room } from "./room" @@ -20,6 +21,26 @@ export abstract class User { this.update_view() } + add_track(t: MediaStreamTrack) { + this.stream.addTrack(t) + this.update_view() + t.onended = () => { + log("media", "track ended", t) + this.stream.removeTrack(t) + this.update_view() + } + t.onmute = () => { + log("media", "track muted", t) + this.stream.removeTrack(t) + this.update_view() + } + t.onunmute = () => { + log("media", "track unmuted", t) + this.stream.addTrack(t) + this.update_view() + } + } + update_view() { if (this.view_el) this.el.removeChild(this.view_el) this.view_el = this.create_view() |