Commit 529eae6
authored
fix: resets audio ui when permission is denied (Chainlit#2771)
Wraps connection to microphone in a try/catch block to automatically
reset ui when permission is not granted.
Without this fix, the UI remains in loading state until the window is
refreshed.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Prevents the audio UI from freezing when microphone permission is denied
by catching setup errors and resetting the session. If access is
blocked, audio capture is cleaned up, the stream ends, and the UI
returns to idle.
- **Bug Fixes**
- Wrapped microphone begin/connect/record in a try/catch to handle setup
failures.
- On permission denial, safely end the recorder (ignore errors),
interrupt the player, emit audio_end, and set audioConnection to off.
<sup>Written for commit 7dbd38d.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->1 parent f8dfa3a commit 529eae6
1 file changed
Lines changed: 26 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | 43 | | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
230 | 232 | | |
231 | | - | |
232 | | - | |
233 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
234 | 245 | | |
235 | 246 | | |
236 | 247 | | |
| |||
0 commit comments