Skip to content

Commit

Permalink
fix ios orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
Predidit committed Aug 18, 2024
1 parent 694fa06 commit 4e0655b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
17 changes: 12 additions & 5 deletions lib/pages/player/player_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:oneanime/utils/constans.dart';
import 'package:flutter/services.dart';
import 'package:flutter/foundation.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:auto_orientation/auto_orientation.dart';
import 'package:window_manager/window_manager.dart';
import 'package:oneanime/utils/storage.dart';
import 'package:hive/hive.dart';
Expand Down Expand Up @@ -127,9 +126,17 @@ abstract class _PlayerController with Store {
if (kIsWeb) {
await document.documentElement?.requestFullscreen();
} else if (Platform.isAndroid || Platform.isIOS) {
await AutoOrientation.landscapeAutoMode(forceSensor: true);
} else if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
await windowManager.setFullScreen(true);
// await SystemChrome.setEnabledSystemUIMode(
// SystemUiMode.immersiveSticky,
// overlays: [],
// );
await SystemChrome.setPreferredOrientations(
[
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
],
);
// await AutoOrientation.landscapeAutoMode(forceSensor: true);
}
} catch (exception, stacktrace) {
debugPrint(exception.toString());
Expand Down Expand Up @@ -162,7 +169,7 @@ abstract class _PlayerController with Store {

Duration get buffer {
if (mediaPlayer.value.buffered.isEmpty) {
return Duration.zero;
return Duration.zero;
}

Duration maxDuration = mediaPlayer.value.buffered[0].end;
Expand Down
8 changes: 0 additions & 8 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.4"
auto_orientation:
dependency: "direct main"
description:
name: auto_orientation
sha256: cd56bb59b36fa54cc28ee254bc600524f022a4862f31d5ab20abd7bb1c54e678
url: "https://pub.dev"
source: hosted
version: "2.3.1"
boolean_selector:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ dependencies:

canvas_danmaku: ^0.1.6

auto_orientation: ^2.3.1
flutter_volume_controller: ^1.3.1
screen_brightness: ^0.2.2+1
screen_pixel: ^0.0.3
Expand Down

0 comments on commit 4e0655b

Please sign in to comment.