feat: add warning when media.play() fails in bind:paused (#17656)

* feat: add warning when media.play() fails in bind:paused

* chore: fix formatting in media.js

* chore: use Rich Harris's suggested approach for media.play() error handling

* Apply suggestion from @Rich-Harris

---------

Co-authored-by: Rich Harris <hello@rich-harris.dev>
pull/17670/head
Mohit Kourav 5 months ago committed by GitHub
parent bd5480b9d0
commit 15fe6b85c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: don't swallow `DOMException` when `media.play()` fails in `bind:paused`

@ -175,8 +175,9 @@ export function bind_paused(media, get, set = get) {
if (paused) {
media.pause();
} else {
media.play().catch(() => {
media.play().catch((error) => {
set((paused = true));
throw error;
});
}
}

Loading…
Cancel
Save