Skip to content

Commit 1a16643

Browse files
author
Lukas
committed
add playbackrate to compilation test
1 parent 8eb8c70 commit 1a16643

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

test/js/samples/media-bindings/expected.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,24 @@ function create_fragment(ctx) {
3838
listen(audio, "pause", ctx.audio_play_pause_handler),
3939
listen(audio, "progress", ctx.audio_progress_handler),
4040
listen(audio, "loadedmetadata", ctx.audio_loadedmetadata_handler),
41-
listen(audio, "volumechange", ctx.audio_volumechange_handler)
41+
listen(audio, "volumechange", ctx.audio_volumechange_handler),
42+
listen(audio, "ratechange", ctx.audio_ratechange_handler)
4243
];
4344
},
4445

4546
m(target, anchor) {
4647
insert(target, audio, anchor);
4748

4849
audio.volume = ctx.volume;
50+
51+
audio.playbackRate = ctx.playbackRate;
4952
},
5053

5154
p(changed, ctx) {
5255
if (!audio_updating && changed.currentTime && !isNaN(ctx.currentTime)) audio.currentTime = ctx.currentTime;
5356
if (changed.paused && audio_is_paused !== (audio_is_paused = ctx.paused)) audio[audio_is_paused ? "pause" : "play"]();
5457
if (changed.volume && !isNaN(ctx.volume)) audio.volume = ctx.volume;
58+
if (changed.playbackRate && !isNaN(ctx.playbackRate)) audio.playbackRate = ctx.playbackRate;
5559
audio_updating = false;
5660
},
5761

@@ -69,7 +73,7 @@ function create_fragment(ctx) {
6973
}
7074

7175
function instance($$self, $$props, $$invalidate) {
72-
let { buffered, seekable, played, currentTime, duration, paused, volume } = $$props;
76+
let { buffered, seekable, played, currentTime, duration, paused, volume, playbackRate } = $$props;
7377

7478
function audio_timeupdate_handler() {
7579
played = time_ranges_to_array(this.played);
@@ -105,6 +109,11 @@ function instance($$self, $$props, $$invalidate) {
105109
$$invalidate('volume', volume);
106110
}
107111

112+
function audio_ratechange_handler() {
113+
playbackRate = this.playbackRate;
114+
$$invalidate('playbackRate', playbackRate);
115+
}
116+
108117
$$self.$set = $$props => {
109118
if ('buffered' in $$props) $$invalidate('buffered', buffered = $$props.buffered);
110119
if ('seekable' in $$props) $$invalidate('seekable', seekable = $$props.seekable);
@@ -113,6 +122,7 @@ function instance($$self, $$props, $$invalidate) {
113122
if ('duration' in $$props) $$invalidate('duration', duration = $$props.duration);
114123
if ('paused' in $$props) $$invalidate('paused', paused = $$props.paused);
115124
if ('volume' in $$props) $$invalidate('volume', volume = $$props.volume);
125+
if ('playbackRate' in $$props) $$invalidate('playbackRate', playbackRate = $$props.playbackRate);
116126
};
117127

118128
return {
@@ -123,19 +133,21 @@ function instance($$self, $$props, $$invalidate) {
123133
duration,
124134
paused,
125135
volume,
136+
playbackRate,
126137
audio_timeupdate_handler,
127138
audio_durationchange_handler,
128139
audio_play_pause_handler,
129140
audio_progress_handler,
130141
audio_loadedmetadata_handler,
131-
audio_volumechange_handler
142+
audio_volumechange_handler,
143+
audio_ratechange_handler
132144
};
133145
}
134146

135147
class SvelteComponent extends SvelteComponent_1 {
136148
constructor(options) {
137149
super();
138-
init(this, options, instance, create_fragment, safe_not_equal, ["buffered", "seekable", "played", "currentTime", "duration", "paused", "volume"]);
150+
init(this, options, instance, create_fragment, safe_not_equal, ["buffered", "seekable", "played", "currentTime", "duration", "paused", "volume", "playbackRate"]);
139151
}
140152
}
141153

test/js/samples/media-bindings/input.svelte

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
export let duration;
77
export let paused;
88
export let volume;
9+
export let playbackRate;
910
</script>
1011

11-
<audio bind:buffered bind:seekable bind:played bind:currentTime bind:duration bind:paused bind:volume/>
12+
<audio bind:buffered bind:seekable bind:played bind:currentTime bind:duration bind:paused bind:volume bind:playbackRate/>

0 commit comments

Comments
 (0)