mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
fix(mobile): video player initialization (#17778)
* fix(mobile): video player initialization * nit
This commit is contained in:
parent
fda68f972f
commit
af36eaa61b
@ -63,9 +63,12 @@ class GalleryViewerPage extends HookConsumerWidget {
|
|||||||
final loadAsset = renderList.loadAsset;
|
final loadAsset = renderList.loadAsset;
|
||||||
final isPlayingMotionVideo = ref.watch(isPlayingMotionVideoProvider);
|
final isPlayingMotionVideo = ref.watch(isPlayingMotionVideoProvider);
|
||||||
|
|
||||||
// This key is to prevent the video player from being re-initialized during
|
final videoPlayerKeys = useRef<Map<int, GlobalKey>>({});
|
||||||
// hero animation or device rotation.
|
|
||||||
final videoPlayerKey = useMemoized(() => GlobalKey());
|
GlobalKey getVideoPlayerKey(int id) {
|
||||||
|
videoPlayerKeys.value.putIfAbsent(id, () => GlobalKey());
|
||||||
|
return videoPlayerKeys.value[id]!;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> precacheNextImage(int index) async {
|
Future<void> precacheNextImage(int index) async {
|
||||||
if (!context.mounted) {
|
if (!context.mounted) {
|
||||||
@ -243,7 +246,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
|||||||
width: context.width,
|
width: context.width,
|
||||||
height: context.height,
|
height: context.height,
|
||||||
child: NativeVideoViewerPage(
|
child: NativeVideoViewerPage(
|
||||||
key: videoPlayerKey,
|
key: getVideoPlayerKey(asset.id),
|
||||||
asset: asset,
|
asset: asset,
|
||||||
image: Image(
|
image: Image(
|
||||||
key: ValueKey(asset),
|
key: ValueKey(asset),
|
||||||
|
@ -12,14 +12,11 @@ class ImmichLogo extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Hero(
|
return Image(
|
||||||
tag: heroTag,
|
image: const AssetImage('assets/immich-logo.png'),
|
||||||
child: Image(
|
width: size,
|
||||||
image: const AssetImage('assets/immich-logo.png'),
|
filterQuality: FilterQuality.high,
|
||||||
width: size,
|
isAntiAlias: true,
|
||||||
filterQuality: FilterQuality.high,
|
|
||||||
isAntiAlias: true,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user