diff --git a/nut_player/lib/src/controller/video_player_controller.dart b/nut_player/lib/src/controller/video_player_controller.dart index 29043db..cd6e9be 100644 --- a/nut_player/lib/src/controller/video_player_controller.dart +++ b/nut_player/lib/src/controller/video_player_controller.dart @@ -225,6 +225,7 @@ class VideoPlayerController extends ValueNotifier { if (value.position == value.duration) { await seek(Duration.zero); } + value = value.copyWith(isPlaying: true); await _applyPlayPause(); } @@ -328,10 +329,14 @@ class VideoPlayerController extends ValueNotifier { Future _applyVolume() async { final playerId = _playerId; - if (_isDisposedOrNotInitialized || playerId == null) { + final volume = value.volume; + if (_isDisposedOrNotInitialized || + playerId == null || + volume == null) { return; } - await nutPlayerPlatform.setVolume(playerId, value.volume); + + await nutPlayerPlatform.setVolume(playerId, volume); } void _updatePosition(Duration position) { diff --git a/nut_player/lib/src/legacy/video_player_value.dart b/nut_player/lib/src/legacy/video_player_value.dart index afc2679..f146bba 100644 --- a/nut_player/lib/src/legacy/video_player_value.dart +++ b/nut_player/lib/src/legacy/video_player_value.dart @@ -20,7 +20,7 @@ class VideoPlayerValue { this.isPlaying = false, this.isLooping = false, this.isBuffering = false, - this.volume = 1.0, + this.volume, this.playbackSpeed = 1.0, this.rotationCorrection = 0, this.errorDescription, @@ -74,7 +74,7 @@ class VideoPlayerValue { final bool isBuffering; /// The current volume of the playback. - final double volume; + final double? volume; /// The current speed of the playback. final double playbackSpeed;