@@ -38,20 +38,24 @@ function create_fragment(ctx) {
38
38
listen ( audio , "pause" , ctx . audio_play_pause_handler ) ,
39
39
listen ( audio , "progress" , ctx . audio_progress_handler ) ,
40
40
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 )
42
43
] ;
43
44
} ,
44
45
45
46
m ( target , anchor ) {
46
47
insert ( target , audio , anchor ) ;
47
48
48
49
audio . volume = ctx . volume ;
50
+
51
+ audio . playbackRate = ctx . playbackRate ;
49
52
} ,
50
53
51
54
p ( changed , ctx ) {
52
55
if ( ! audio_updating && changed . currentTime && ! isNaN ( ctx . currentTime ) ) audio . currentTime = ctx . currentTime ;
53
56
if ( changed . paused && audio_is_paused !== ( audio_is_paused = ctx . paused ) ) audio [ audio_is_paused ? "pause" : "play" ] ( ) ;
54
57
if ( changed . volume && ! isNaN ( ctx . volume ) ) audio . volume = ctx . volume ;
58
+ if ( changed . playbackRate && ! isNaN ( ctx . playbackRate ) ) audio . playbackRate = ctx . playbackRate ;
55
59
audio_updating = false ;
56
60
} ,
57
61
@@ -69,7 +73,7 @@ function create_fragment(ctx) {
69
73
}
70
74
71
75
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 ;
73
77
74
78
function audio_timeupdate_handler ( ) {
75
79
played = time_ranges_to_array ( this . played ) ;
@@ -105,6 +109,11 @@ function instance($$self, $$props, $$invalidate) {
105
109
$$invalidate ( 'volume' , volume ) ;
106
110
}
107
111
112
+ function audio_ratechange_handler ( ) {
113
+ playbackRate = this . playbackRate ;
114
+ $$invalidate ( 'playbackRate' , playbackRate ) ;
115
+ }
116
+
108
117
$$self . $set = $$props => {
109
118
if ( 'buffered' in $$props ) $$invalidate ( 'buffered' , buffered = $$props . buffered ) ;
110
119
if ( 'seekable' in $$props ) $$invalidate ( 'seekable' , seekable = $$props . seekable ) ;
@@ -113,6 +122,7 @@ function instance($$self, $$props, $$invalidate) {
113
122
if ( 'duration' in $$props ) $$invalidate ( 'duration' , duration = $$props . duration ) ;
114
123
if ( 'paused' in $$props ) $$invalidate ( 'paused' , paused = $$props . paused ) ;
115
124
if ( 'volume' in $$props ) $$invalidate ( 'volume' , volume = $$props . volume ) ;
125
+ if ( 'playbackRate' in $$props ) $$invalidate ( 'playbackRate' , playbackRate = $$props . playbackRate ) ;
116
126
} ;
117
127
118
128
return {
@@ -123,19 +133,21 @@ function instance($$self, $$props, $$invalidate) {
123
133
duration,
124
134
paused,
125
135
volume,
136
+ playbackRate,
126
137
audio_timeupdate_handler,
127
138
audio_durationchange_handler,
128
139
audio_play_pause_handler,
129
140
audio_progress_handler,
130
141
audio_loadedmetadata_handler,
131
- audio_volumechange_handler
142
+ audio_volumechange_handler,
143
+ audio_ratechange_handler
132
144
} ;
133
145
}
134
146
135
147
class SvelteComponent extends SvelteComponent_1 {
136
148
constructor ( options ) {
137
149
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" ] ) ;
139
151
}
140
152
}
141
153
0 commit comments