comparison libervia/web/pages/calls/_browser/webrtc.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 e65d2ef1ded4
comparison
equal deleted inserted replaced
1564:bd3c880f4a47 1565:d282dbdd5ffd
20 screen_sharing_cb=None, 20 screen_sharing_cb=None,
21 on_connection_established_cb=None, 21 on_connection_established_cb=None,
22 on_reconnect_cb=None, 22 on_reconnect_cb=None,
23 on_connection_lost_cb=None, 23 on_connection_lost_cb=None,
24 on_video_devices=None, 24 on_video_devices=None,
25 on_reset_cb=None,
25 ): 26 ):
27 # reset
28 self.on_reset_cb = on_reset_cb
26 self.reset_instance() 29 self.reset_instance()
27 30
28 # ICE events 31 # ICE events
29 bridge.register_signal("ice_candidates_new", self._on_ice_candidates_new) 32 bridge.register_signal("ice_candidates_new", self._on_ice_candidates_new)
30 bridge.register_signal("ice_restart", self._on_ice_restart) 33 bridge.register_signal("ice_restart", self._on_ice_restart)
79 "audio": {"candidates": []}, 82 "audio": {"candidates": []},
80 "video": {"candidates": []}, 83 "video": {"candidates": []},
81 } 84 }
82 self.media_candidates = {} 85 self.media_candidates = {}
83 self.candidates_gathered = aio.Future() 86 self.candidates_gathered = aio.Future()
87 if self.on_reset_cb is not None:
88 self.on_reset_cb()
84 89
85 async def _populate_video_devices(self): 90 async def _populate_video_devices(self):
86 devices = await window.navigator.mediaDevices.enumerateDevices() 91 devices = await window.navigator.mediaDevices.enumerateDevices()
87 devices_ids = set() 92 devices_ids = set()
88 self.video_devices.clear() 93 self.video_devices.clear()