File tree Expand file tree Collapse file tree
packages/video_player/video_player_web Expand file tree Collapse file tree 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+
15## 0.1.3+2
26
37* 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 {
119119 return _videoPlayers[textureId].setVolume (volume);
120120 }
121121
122+ @override
123+ Future <void > setPlaybackSpeed (int textureId, double speed) async {
124+ assert (speed > 0 );
125+
126+ return _videoPlayers[textureId].setPlaybackSpeed (speed);
127+ }
128+
122129 @override
123130 Future <void > seekTo (int textureId, Duration position) async {
124131 return _videoPlayers[textureId].seekTo (position);
@@ -232,6 +239,12 @@ class _VideoPlayer {
232239 videoElement.volume = value;
233240 }
234241
242+ void setPlaybackSpeed (double speed) {
243+ assert (speed > 0 );
244+
245+ videoElement.playbackRate = speed;
246+ }
247+
235248 void seekTo (Duration position) {
236249 videoElement.currentTime = position.inMilliseconds.toDouble () / 1000 ;
237250 }
Original file line number Diff line number Diff line change 11name : video_player_web
2- description : Web platform implementation of video_player
2+ description : Web platform implementation of video_player.
33homepage : https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_web
44# 0.1.y+z is compatible with 1.0.0, if you land a breaking change bump
55# the version to 2.0.0.
66# 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
88
99flutter :
1010 plugin :
@@ -19,7 +19,7 @@ dependencies:
1919 flutter_web_plugins :
2020 sdk : flutter
2121 meta : ^1.1.7
22- video_player_platform_interface : ^2.0 .0
22+ video_player_platform_interface : ^2.2 .0
2323
2424dev_dependencies :
2525 flutter_test :
@@ -29,5 +29,5 @@ dev_dependencies:
2929 pedantic : ^1.8.0
3030
3131environment :
32- sdk : " >=2.1 .0 <3.0.0"
32+ sdk : " >=2.8 .0 <3.0.0"
3333 flutter : " >=1.12.8 <2.0.0"
Original file line number Diff line number Diff line change @@ -109,6 +109,13 @@ void main() {
109109 expect (VideoPlayerPlatform .instance.setVolume (textureId, 0.8 ), completes);
110110 });
111111
112+ test ('can set playback speed' , () {
113+ expect (
114+ VideoPlayerPlatform .instance.setPlaybackSpeed (textureId, 2.0 ),
115+ completes,
116+ );
117+ });
118+
112119 test ('can seek to position' , () {
113120 expect (
114121 VideoPlayerPlatform .instance.seekTo (textureId, Duration (seconds: 1 )),
You can’t perform that action at this time.
0 commit comments