aboutsummaryrefslogtreecommitdiff
path: root/client-web/source/user/local.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client-web/source/user/local.ts')
-rw-r--r--client-web/source/user/local.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/client-web/source/user/local.ts b/client-web/source/user/local.ts
index a741726..2ea1ea6 100644
--- a/client-web/source/user/local.ts
+++ b/client-web/source/user/local.ts
@@ -7,7 +7,7 @@ import { get_rnnoise_node } from "../rnnoise.ts";
import { Room } from "../room.ts";
import { TrackHandle } from "../track_handle.ts";
import { User } from "./mod.ts";
-import { BOTTOM_CONTAINER } from "../index.ts";
+import { BOTTOM_CONTAINER, ROOM_CONTAINER } from "../index.ts";
export class LocalUser extends User {
mic_gain?: GainNode
@@ -17,10 +17,16 @@ export class LocalUser extends User {
super(room, id)
this.el.classList.add("local")
this.local = true
+ this.name = PREFS.username
this.create_controls()
this.add_initial_tracks()
log("usermodel", `added local user: ${this.display_name}`)
}
+ leave() { // we might never need this but ok
+ this.room.local_user = undefined as unknown as LocalUser
+ super.leave()
+ ROOM_CONTAINER.removeChild(this.el)
+ }
async add_initial_tracks() {
if (PREFS.microphone_enabled) this.publish_track(await this.create_mic_track())
@@ -43,6 +49,9 @@ export class LocalUser extends User {
add_initial_to_remote(u: RemoteUser) {
this.tracks.forEach(t => u.peer.addTrack(t.track))
}
+ identify(recipient?: number) {
+ if (this.name) this.room.signaling.send_relay({ identify: { username: this.name } }, recipient)
+ }
create_controls() {
const mic_toggle = document.createElement("input")