File tree Expand file tree Collapse file tree 4 files changed +28
-4
lines changed
packages/video_player/video_player_web Expand file tree Collapse file tree 4 files changed +28
-4
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.1.4
2
+
3
+ * Added option to set the video playback speed on the video controller.
4
+
1
5
## 0.1.3+2
2
6
3
7
* Allow users to set the 'muted' attribute on video elements by setting their volume to 0.
Original file line number Diff line number Diff line change @@ -119,6 +119,13 @@ class VideoPlayerPlugin extends VideoPlayerPlatform {
119
119
return _videoPlayers[textureId].setVolume (volume);
120
120
}
121
121
122
+ @override
123
+ Future <void > setPlaybackSpeed (int textureId, double speed) async {
124
+ assert (speed > 0 );
125
+
126
+ return _videoPlayers[textureId].setPlaybackSpeed (speed);
127
+ }
128
+
122
129
@override
123
130
Future <void > seekTo (int textureId, Duration position) async {
124
131
return _videoPlayers[textureId].seekTo (position);
@@ -232,6 +239,12 @@ class _VideoPlayer {
232
239
videoElement.volume = value;
233
240
}
234
241
242
+ void setPlaybackSpeed (double speed) {
243
+ assert (speed > 0 );
244
+
245
+ videoElement.playbackRate = speed;
246
+ }
247
+
235
248
void seekTo (Duration position) {
236
249
videoElement.currentTime = position.inMilliseconds.toDouble () / 1000 ;
237
250
}
Original file line number Diff line number Diff line change 1
1
name : video_player_web
2
- description : Web platform implementation of video_player
2
+ description : Web platform implementation of video_player.
3
3
homepage : https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_web
4
4
# 0.1.y+z is compatible with 1.0.0, if you land a breaking change bump
5
5
# the version to 2.0.0.
6
6
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
7
- version : 0.1.3+2
7
+ version : 0.1.4
8
8
9
9
flutter :
10
10
plugin :
@@ -19,7 +19,7 @@ dependencies:
19
19
flutter_web_plugins :
20
20
sdk : flutter
21
21
meta : ^1.1.7
22
- video_player_platform_interface : ^2.0 .0
22
+ video_player_platform_interface : ^2.2 .0
23
23
24
24
dev_dependencies :
25
25
flutter_test :
@@ -29,5 +29,5 @@ dev_dependencies:
29
29
pedantic : ^1.8.0
30
30
31
31
environment :
32
- sdk : " >=2.1 .0 <3.0.0"
32
+ sdk : " >=2.8 .0 <3.0.0"
33
33
flutter : " >=1.12.8 <2.0.0"
Original file line number Diff line number Diff line change @@ -109,6 +109,13 @@ void main() {
109
109
expect (VideoPlayerPlatform .instance.setVolume (textureId, 0.8 ), completes);
110
110
});
111
111
112
+ test ('can set playback speed' , () {
113
+ expect (
114
+ VideoPlayerPlatform .instance.setPlaybackSpeed (textureId, 2.0 ),
115
+ completes,
116
+ );
117
+ });
118
+
112
119
test ('can seek to position' , () {
113
120
expect (
114
121
VideoPlayerPlatform .instance.seekTo (textureId, Duration (seconds: 1 )),
You can’t perform that action at this time.
0 commit comments