comparison 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
comparison
equal deleted inserted replaced
1564:bd3c880f4a47 1565:d282dbdd5ffd
38 screen_sharing_cb=self.on_sharing_screen, 38 screen_sharing_cb=self.on_sharing_screen,
39 on_connection_established_cb=self.on_connection_established, 39 on_connection_established_cb=self.on_connection_established,
40 on_reconnect_cb=self.on_reconnect, 40 on_reconnect_cb=self.on_reconnect,
41 on_connection_lost_cb=self.on_connection_lost, 41 on_connection_lost_cb=self.on_connection_lost,
42 on_video_devices=self.on_video_devices, 42 on_video_devices=self.on_video_devices,
43 on_reset_cb=self.on_reset_cb,
43 ) 44 )
44 self.mode = "search" 45 self.mode = "search"
45 self._status = None 46 self._status = None
46 self._callee = None 47 self._callee = None
47 self.contacts_elt = document["contacts"] 48 self.contacts_elt = document["contacts"]
317 if has_multiple_cameras: 318 if has_multiple_cameras:
318 switch_camera_col_elt.classList.remove("is-hidden", "is-hidden-desktop") 319 switch_camera_col_elt.classList.remove("is-hidden", "is-hidden-desktop")
319 else: 320 else:
320 switch_camera_col_elt.classList.add("is-hidden") 321 switch_camera_col_elt.classList.add("is-hidden")
321 322
323 def on_reset_cb(self) -> None:
324 """Call when webRTC connection is reset, we reset buttons statuses"""
325 document["full_screen_btn"].classList.remove("is-hidden")
326 document["exit_full_screen_btn"].classList.add("is-hidden")
327 for btn_elt in document["mute_audio_btn"], document["mute_video_btn"]:
328 btn_elt.classList.remove(INACTIVE_CLASS, MUTED_CLASS, "is-warning")
329 btn_elt.classList.add("is-success")
330
322 async def make_call(self, audio: bool = True, video: bool = True) -> None: 331 async def make_call(self, audio: bool = True, video: bool = True) -> None:
323 """Start a WebRTC call 332 """Start a WebRTC call
324 333
325 @param audio: True if an audio flux is required 334 @param audio: True if an audio flux is required
326 @param video: True if a video flux is required 335 @param video: True if a video flux is required