mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 06:46:22 +01:00
Fix screen turning off while watching video
This commit is contained in:
parent
d722fda3e0
commit
60339968de
3 changed files with 41 additions and 1 deletions
|
@ -8,6 +8,7 @@ import 'package:nc_photos/entity/file.dart';
|
|||
import 'package:nc_photos/k.dart' as k;
|
||||
import 'package:nc_photos/widget/animated_visibility.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
import 'package:wakelock/wakelock.dart';
|
||||
|
||||
class VideoViewer extends StatefulWidget {
|
||||
VideoViewer({
|
||||
|
@ -55,6 +56,8 @@ class _VideoViewerState extends State<VideoViewer> {
|
|||
_log.shout("[initState] Filed while initialize", e, stacktrace);
|
||||
});
|
||||
_controller.addListener(_onControllerChanged);
|
||||
|
||||
Wakelock.enable();
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -78,6 +81,7 @@ class _VideoViewerState extends State<VideoViewer> {
|
|||
dispose() {
|
||||
super.dispose();
|
||||
_controller?.dispose();
|
||||
Wakelock.disable();
|
||||
}
|
||||
|
||||
Widget _buildPlayer(BuildContext context) {
|
||||
|
|
37
pubspec.lock
37
pubspec.lock
|
@ -818,6 +818,41 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.2.0"
|
||||
wakelock:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: wakelock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.5.2"
|
||||
wakelock_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: wakelock_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.0+1"
|
||||
wakelock_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: wakelock_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.1+1"
|
||||
wakelock_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: wakelock_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0+1"
|
||||
wakelock_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: wakelock_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.0"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -869,4 +904,4 @@ packages:
|
|||
version: "3.1.0"
|
||||
sdks:
|
||||
dart: ">=2.12.0 <3.0.0"
|
||||
flutter: ">=1.24.0-10.2.pre"
|
||||
flutter: ">=2.0.0"
|
||||
|
|
|
@ -73,6 +73,7 @@ dependencies:
|
|||
url: https://gitlab.com/nkming2/flutter-plugins
|
||||
ref: video-player-nc-photos
|
||||
path: packages/video_player/video_player
|
||||
wakelock: ^0.5.2
|
||||
xml: ^5.0.2
|
||||
|
||||
dev_dependencies:
|
||||
|
|
Loading…
Reference in a new issue