diff 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
line wrap: on
line diff
--- a/libervia/web/pages/calls/_browser/webrtc.py	Fri Aug 18 17:43:01 2023 +0200
+++ b/libervia/web/pages/calls/_browser/webrtc.py	Mon Aug 21 15:23:22 2023 +0200
@@ -22,7 +22,10 @@
         on_reconnect_cb=None,
         on_connection_lost_cb=None,
         on_video_devices=None,
+        on_reset_cb=None,
     ):
+        # reset
+        self.on_reset_cb = on_reset_cb
         self.reset_instance()
 
         # ICE events
@@ -81,6 +84,8 @@
         }
         self.media_candidates = {}
         self.candidates_gathered = aio.Future()
+        if self.on_reset_cb is not None:
+            self.on_reset_cb()
 
     async def _populate_video_devices(self):
         devices = await window.navigator.mediaDevices.enumerateDevices()