Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] fix video mute functionality with async state updates

r4khul9f576156c338
diff --git a/mobile/apps/photos/lib/ui/viewer/file/video_control/mute_button.dart b/mobile/apps/photos/lib/ui/viewer/file/video_control/mute_button.dart
index 7019814c07..e5bb5a1eaf 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/video_control/mute_button.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/video_control/mute_button.dart
@@ -55,9 +55,9 @@ class _VideoMuteButtonState extends State<VideoMuteButton> {
size: 20,
),
),
- onPressed: () {
+ onPressed: () async {
final newValue = !_isMuted;
- localSettings.setIsMuted(newValue);
+ await localSettings.setIsMuted(newValue);
Bus.instance.fire(VideoMuteChangedEvent(newValue));
},
);
diff --git a/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart b/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart
index 8dc31842f9..de7d20ecf6 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart
@@ -122,8 +122,10 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
});
_muteSubscription = Bus.instance.on<VideoMuteChangedEvent>().listen((
event,
- ) {
- _controller?.setVolume(event.isMuted ? 0.0 : 1.0);
+ ) async {
+ final controller = _controller;
+ if (controller == null) return;
+ await controller.setVolume(event.isMuted ? 0.0 : 1.0);
});
_guestViewEventSubscription = Bus.instance.on<GuestViewEvent>().listen((
event,