diff options
| author | MetaMuffin <metamuffin@yandex.com> | 2021-08-06 15:04:50 +0200 | 
|---|---|---|
| committer | MetaMuffin <metamuffin@yandex.com> | 2021-08-06 15:04:50 +0200 | 
| commit | fe66a0b23dafd562fc50ddfe5ba326ee33872c24 (patch) | |
| tree | fbe80cc7acddbf34b109c5ae5fdee5eb5e7ccae9 /source/client | |
| parent | 23655aec49f4920a8d5fa77899a0199dc651c907 (diff) | |
| download | keks-meet-fe66a0b23dafd562fc50ddfe5ba326ee33872c24.tar keks-meet-fe66a0b23dafd562fc50ddfe5ba326ee33872c24.tar.bz2 keks-meet-fe66a0b23dafd562fc50ddfe5ba326ee33872c24.tar.zst | |
mute preview of local user
Diffstat (limited to 'source/client')
| -rw-r--r-- | source/client/local_user.ts | 3 | ||||
| -rw-r--r-- | source/client/user.ts | 4 | 
2 files changed, 6 insertions, 1 deletions
| diff --git a/source/client/local_user.ts b/source/client/local_user.ts index 729dcb7..78652b3 100644 --- a/source/client/local_user.ts +++ b/source/client/local_user.ts @@ -16,6 +16,7 @@ export class LocalUser extends User {      constructor(room: Room, name: string) {          super(room, name)          this.el.classList.add("local") +        this.local = true          this.create_controls()          if (parameter_bool("audio_enabled", false)) this.enable_audio()          if (parameter_bool("video_enabled", false)) this.enable_video() @@ -93,6 +94,7 @@ export class LocalUser extends User {          this.audio_track = t          this.room.remote_users.forEach(u => u.peer.addTrack(t)) +        this.stream.addTrack(t)          this.update_view_w()      }      async disable_video() { @@ -113,6 +115,7 @@ export class LocalUser extends User {                  if (s.track == this.audio_track) u.peer.removeTrack(s)              })          }) +        this.stream.removeTrack(this.audio_track)          this.update_view_w()          this.audio_track = undefined      } diff --git a/source/client/user.ts b/source/client/user.ts index 579886f..f4f33e1 100644 --- a/source/client/user.ts +++ b/source/client/user.ts @@ -22,7 +22,7 @@ export abstract class User {          this.el.classList.add("user")          this.room.el.append(this.el)          this.setup_view() -        this.update_view() +        setTimeout(() => this.update_view(), 1)      }      add_track(t: MediaStreamTrack) { @@ -79,6 +79,7 @@ export abstract class User {      create_media_view() {          const has_video = this.stream.getVideoTracks().length > 0          const has_audio = this.stream.getAudioTracks().length > 0 +        if (this.local && !has_video) return document.createElement("div")          const media_el = has_video ? document.createElement("video") : document.createElement("audio")          media_el.classList.add("media")          media_el.autoplay = true @@ -87,6 +88,7 @@ export abstract class User {          if (has_video) media_el.addEventListener("click", () => {              media_el.classList.remove("maximized")          }) +        if (this.local) media_el.muted = true          const controls_el = document.createElement("div")          controls_el.classList.add("media-controls") | 
