diff --git a/src/compiler/compile/render_dom/wrappers/Element/Binding.ts b/src/compiler/compile/render_dom/wrappers/Element/Binding.ts index d06552e00d..9618ad3c2c 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/Binding.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/Binding.ts @@ -140,6 +140,7 @@ export default class BindingWrapper { case 'playbackRate': case 'volume': update_conditions.push(x`!@_isNaN(${this.snippet})`); + mount_conditions.push(x`!@_isNaN(${this.snippet})`); break; case 'paused': diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index 28a6a02b47..0538f07055 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -58,8 +58,14 @@ function create_fragment(ctx) { }, m(target, anchor) { insert(target, audio, anchor); - audio.volume = ctx.volume; - audio.playbackRate = ctx.playbackRate; + + if (!isNaN(ctx.volume)) { + audio.volume = ctx.volume; + } + + if (!isNaN(ctx.playbackRate)) { + audio.playbackRate = ctx.playbackRate; + } }, p(changed, ctx) { if (!audio_updating && changed.currentTime && !isNaN(ctx.currentTime)) {