PSDK-1020: Исправлены установки звука

This commit is contained in:
Андрей Геращенко
2023-10-31 19:49:53 +03:00
committed by Elena Nazarova
parent 641ab5d5a2
commit 0afeb548c8
2 changed files with 9 additions and 4 deletions
@@ -225,6 +225,7 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
if (value.position == value.duration) {
await seek(Duration.zero);
}
value = value.copyWith(isPlaying: true);
await _applyPlayPause();
}
@@ -328,10 +329,14 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
Future<void> _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) {
@@ -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;