Skip to content

Commit

Permalink
refactor: native_video_player
Browse files Browse the repository at this point in the history
  • Loading branch information
shenlong-tanwen committed Aug 28, 2024
1 parent 6953d1d commit 0136864
Show file tree
Hide file tree
Showing 9 changed files with 243 additions and 227 deletions.
36 changes: 13 additions & 23 deletions mobile/lib/pages/common/gallery_viewer.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/entities/asset.entity.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/pages/common/native_video_viewer.page.dart';
import 'package:immich_mobile/pages/common/video_viewer.page.dart';
import 'package:immich_mobile/providers/app_settings.provider.dart';
import 'package:immich_mobile/providers/asset_viewer/asset_stack.provider.dart';
import 'package:immich_mobile/providers/asset_viewer/current_asset.provider.dart';
Expand Down Expand Up @@ -352,10 +351,6 @@ class GalleryViewerPage extends HookConsumerWidget {
),
);
} else {
final useNativePlayer =
a.isLocal && a.livePhotoVideoId == null;
debugPrint("asset.isLocal ${asset.isLocal}");
debugPrint("build video player $useNativePlayer");
return PhotoViewGalleryPageOptions.customChild(
onDragStart: (_, details, __) =>
localPosition.value = details.localPosition,
Expand All @@ -370,24 +365,19 @@ class GalleryViewerPage extends HookConsumerWidget {
maxScale: 1.0,
minScale: 1.0,
basePosition: Alignment.center,
child: useNativePlayer
? NativeVideoViewerPage(
key: ValueKey(a),
asset: a,
)
: VideoViewerPage(
key: ValueKey(a),
asset: a,
isMotionVideo: a.livePhotoVideoId != null,
loopVideo: shouldLoopVideo.value,
placeholder: Image(
image: provider,
fit: BoxFit.contain,
height: context.height,
width: context.width,
alignment: Alignment.center,
),
),
child: NativeVideoViewerPage(
key: ValueKey(a),
asset: a,
isMotionVideo: a.livePhotoVideoId != null,
loopVideo: shouldLoopVideo.value,
placeholder: Image(
image: provider,
fit: BoxFit.contain,
height: context.height,
width: context.width,
alignment: Alignment.center,
),
),
);
}
},
Expand Down
Loading

0 comments on commit 0136864

Please sign in to comment.