mirror of
https://github.com/immich-app/immich.git
synced 2025-03-11 15:09:45 +02:00
* Fixes double video auto initialize issue and placeholder for video controller * WIP unravel stack index * Refactors video player controller format fixing video format Working format * Fixes hide on pause * Got hiding when tapped working * Hides controls when video starts and fixes placeholder for memory card Remove prints * Fixes show controls with microtask * fix LivePhotos not playing * removes unused function callbacks and moves wakelock * Update motion video * Fixing motion photo playing * Renames to isPlayingVideo * Fixes playing video on change * pause on dispose * fixing issues with sync between controls * Adds gallery app bar * Switches to memoized * Fixes pause * Revert "Switches to memoized" This reverts commit 234e6741dea05aa0b967dde746f1d625f15bed94. * uses stateful widget * Fixes double video play by using provider and new chewie video player wip format Fixes motion photos format --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
46 lines
1.4 KiB
Dart
46 lines
1.4 KiB
Dart
import 'package:chewie/chewie.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/modules/asset_viewer/hooks/chewiew_controller_hook.dart';
|
|
import 'package:immich_mobile/modules/asset_viewer/ui/custom_video_player_controls.dart';
|
|
import 'package:video_player/video_player.dart';
|
|
|
|
class VideoPlayerViewer extends HookConsumerWidget {
|
|
final VideoPlayerController controller;
|
|
final bool isMotionVideo;
|
|
final Widget? placeholder;
|
|
final Duration hideControlsTimer;
|
|
final bool showControls;
|
|
final bool showDownloadingIndicator;
|
|
|
|
const VideoPlayerViewer({
|
|
super.key,
|
|
required this.controller,
|
|
required this.isMotionVideo,
|
|
this.placeholder,
|
|
required this.hideControlsTimer,
|
|
required this.showControls,
|
|
required this.showDownloadingIndicator,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final chewie = useChewieController(
|
|
controller: controller,
|
|
controlsSafeAreaMinimum: const EdgeInsets.only(
|
|
bottom: 100,
|
|
),
|
|
placeholder: SizedBox.expand(child: placeholder),
|
|
customControls: CustomVideoPlayerControls(
|
|
hideTimerDuration: hideControlsTimer,
|
|
),
|
|
showControls: showControls && !isMotionVideo,
|
|
hideControlsTimer: hideControlsTimer,
|
|
);
|
|
|
|
return Chewie(
|
|
controller: chewie,
|
|
);
|
|
}
|
|
}
|