Skip to content

Commit

Permalink
feat: replaced wakelock
Browse files Browse the repository at this point in the history
jhomlala committed Nov 12, 2023
1 parent 839b85e commit 00ea930
Showing 6 changed files with 188 additions and 106 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.1.0
* Updated ExoPlayer version to 2.19.1
* Updated Kotlin version to 1.8.22.
* Replaced wakelock with wakelock_plus.

## 0.0.83
* Updated dependencies
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ android {
}

defaultConfig {
minSdkVersion 16
minSdkVersion 19
}

dependencies {
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ android {

defaultConfig {
applicationId "com.jhomlala.better_player_example"
minSdkVersion 16
minSdkVersion 19
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
9 changes: 5 additions & 4 deletions lib/src/core/better_player.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'dart:async';

import 'package:better_player/better_player.dart';
import 'package:better_player/src/configuration/better_player_controller_event.dart';
import 'package:better_player/src/core/better_player_utils.dart';
import 'package:better_player/src/core/better_player_with_controls.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:visibility_detector/visibility_detector.dart';
import 'package:wakelock/wakelock.dart';
import 'package:wakelock_plus/wakelock_plus.dart';

///Widget which uses provided controller to render video player.
class BetterPlayer extends StatefulWidget {
@@ -102,7 +103,7 @@ class _BetterPlayerState extends State<BetterPlayer>
///full screen is on, then full screen route must be pop and return to normal
///state.
if (_isFullScreen) {
Wakelock.disable();
WakelockPlus.disable();
_navigatorState.maybePop();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: _betterPlayerConfiguration.systemOverlaysAfterFullScreen);
@@ -244,7 +245,7 @@ class _BetterPlayerState extends State<BetterPlayer>
}

if (!_betterPlayerConfiguration.allowedScreenSleep) {
Wakelock.enable();
WakelockPlus.enable();
}

await Navigator.of(context, rootNavigator: true).push(route);
@@ -253,7 +254,7 @@ class _BetterPlayerState extends State<BetterPlayer>

// The wakelock plugins checks whether it needs to perform an action internally,
// so we do not need to check Wakelock.isEnabled.
Wakelock.disable();
WakelockPlus.disable();

await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: _betterPlayerConfiguration.systemOverlaysAfterFullScreen);
278 changes: 179 additions & 99 deletions pubspec.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.5
wakelock: ^0.6.1+2
wakelock_plus: ^1.1.3
meta: ^1.7.0
flutter_widget_from_html_core: ^0.8.5+3
visibility_detector: ^0.3.3

0 comments on commit 00ea930

Please sign in to comment.