Mercurial > libervia-web
diff libervia/web/pages/calls/_browser/__init__.py @ 1565:d282dbdd5ffd
browser (calls): restore UI state on reset:
`on_reset` is now called when webRTC reset happens (notably when a call ends). The UI
state is reset, in particular mute buttons so they don't appear in the wrong state during
the next call.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 21 Aug 2023 15:23:22 +0200 |
parents | bd3c880f4a47 |
children | 0a4433a343a3 |
line wrap: on
line diff
--- a/libervia/web/pages/calls/_browser/__init__.py Fri Aug 18 17:43:01 2023 +0200 +++ b/libervia/web/pages/calls/_browser/__init__.py Mon Aug 21 15:23:22 2023 +0200 @@ -40,6 +40,7 @@ on_reconnect_cb=self.on_reconnect, on_connection_lost_cb=self.on_connection_lost, on_video_devices=self.on_video_devices, + on_reset_cb=self.on_reset_cb, ) self.mode = "search" self._status = None @@ -319,6 +320,14 @@ else: switch_camera_col_elt.classList.add("is-hidden") + def on_reset_cb(self) -> None: + """Call when webRTC connection is reset, we reset buttons statuses""" + document["full_screen_btn"].classList.remove("is-hidden") + document["exit_full_screen_btn"].classList.add("is-hidden") + for btn_elt in document["mute_audio_btn"], document["mute_video_btn"]: + btn_elt.classList.remove(INACTIVE_CLASS, MUTED_CLASS, "is-warning") + btn_elt.classList.add("is-success") + async def make_call(self, audio: bool = True, video: bool = True) -> None: """Start a WebRTC call