i2edu 5 سال پیش
والد
کامیت
0973da6e2c
3فایلهای تغییر یافته به همراه10 افزوده شده و 6 حذف شده
  1. 0 1
      example/pubspec.yaml
  2. 9 4
      lib/src/chewie_player.dart
  3. 1 1
      pubspec.yaml

+ 0 - 1
example/pubspec.yaml

@@ -9,7 +9,6 @@ dependencies:
 #    git:
 #      url: https://git.i2erp.cn/plugins/video_chewie.git
   video_player: ^0.10.1
-  auto_orientation: ^0.0.2
   flutter:
     sdk: flutter
 

+ 9 - 4
lib/src/chewie_player.dart

@@ -1,5 +1,6 @@
 import 'dart:async';
 
+import 'package:auto_orientation/auto_orientation.dart';
 import 'package:chewie/src/chewie_progress_colors.dart';
 import 'package:chewie/src/player_with_controls.dart';
 import 'package:flutter/material.dart';
@@ -128,10 +129,14 @@ class ChewieState extends State<Chewie> {
     );
 
     SystemChrome.setEnabledSystemUIOverlays([]);
-    SystemChrome.setPreferredOrientations([
-      DeviceOrientation.landscapeLeft,
-      DeviceOrientation.landscapeRight,
-    ]);
+    if(isAndroid){
+      SystemChrome.setPreferredOrientations([
+        DeviceOrientation.landscapeLeft,
+        DeviceOrientation.landscapeRight,
+      ]);
+    }else{
+      AutoOrientation.landscapeLeftMode();
+    }
 
     if (!widget.controller.allowedScreenSleep) {
       Wakelock.enable();

+ 1 - 1
pubspec.yaml

@@ -22,7 +22,7 @@ dependencies:
   event_bus:
     git:
       url: https://git.i2erp.cn/plugins/event_bus.git
-
+  auto_orientation: ^1.0.6
   flutter:
     sdk: flutter