mirror of
https://github.com/immich-app/immich.git
synced 2025-06-03 05:34:32 -04:00
fix(mobile): video player not updating state (#10220)
* fix(mobile): video player not updating state * unused code
This commit is contained in:
parent
47ef48e3c2
commit
67e98ed313
@ -75,9 +75,7 @@ class VideoViewerPage extends HookConsumerWidget {
|
|||||||
// Also sets the error if there is an error in the playback
|
// Also sets the error if there is an error in the playback
|
||||||
void updateVideoPlayback() {
|
void updateVideoPlayback() {
|
||||||
final videoPlayback = VideoPlaybackValue.fromController(controller);
|
final videoPlayback = VideoPlaybackValue.fromController(controller);
|
||||||
if (!loopVideo) {
|
ref.read(videoPlaybackValueProvider.notifier).value = videoPlayback;
|
||||||
ref.read(videoPlaybackValueProvider.notifier).value = videoPlayback;
|
|
||||||
}
|
|
||||||
final state = videoPlayback.state;
|
final state = videoPlayback.state;
|
||||||
|
|
||||||
// Enable the WakeLock while the video is playing
|
// Enable the WakeLock while the video is playing
|
||||||
@ -110,7 +108,9 @@ class VideoViewerPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Subscribes to listener
|
// Subscribes to listener
|
||||||
controller.addListener(updateVideoPlayback);
|
Future.microtask(() {
|
||||||
|
controller.addListener(updateVideoPlayback);
|
||||||
|
});
|
||||||
return () {
|
return () {
|
||||||
// Removes listener when we dispose
|
// Removes listener when we dispose
|
||||||
controller.removeListener(updateVideoPlayback);
|
controller.removeListener(updateVideoPlayback);
|
||||||
|
@ -93,4 +93,18 @@ class VideoPlayerControls extends StateNotifier<VideoPlaybackControls> {
|
|||||||
pause: !state.pause,
|
pause: !state.pause,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void restart() {
|
||||||
|
state = VideoPlaybackControls(
|
||||||
|
position: 0,
|
||||||
|
mute: state.mute,
|
||||||
|
pause: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
state = VideoPlaybackControls(
|
||||||
|
position: 0,
|
||||||
|
mute: state.mute,
|
||||||
|
pause: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,8 @@ class CustomVideoPlayerControls extends HookConsumerWidget {
|
|||||||
final state = ref.read(videoPlaybackValueProvider).state;
|
final state = ref.read(videoPlaybackValueProvider).state;
|
||||||
if (state == VideoPlaybackState.playing) {
|
if (state == VideoPlaybackState.playing) {
|
||||||
ref.read(videoPlayerControlsProvider.notifier).pause();
|
ref.read(videoPlayerControlsProvider.notifier).pause();
|
||||||
|
} else if (state == VideoPlaybackState.completed) {
|
||||||
|
ref.read(videoPlayerControlsProvider.notifier).restart();
|
||||||
} else {
|
} else {
|
||||||
ref.read(videoPlayerControlsProvider.notifier).play();
|
ref.read(videoPlayerControlsProvider.notifier).play();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user