Skip to content

Commit

Permalink
fix video aspect ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
Predidit committed Aug 19, 2024
1 parent 4e0655b commit e2befcd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
6 changes: 3 additions & 3 deletions lib/pages/player/player_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ abstract class _PlayerController with Store {
await windowManager.setFullScreen(true);
return;
}
await SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
// await SystemChrome.setPreferredOrientations([
// DeviceOrientation.portraitUp,
// ]);
await landScape();
await SystemChrome.setEnabledSystemUIMode(
SystemUiMode.immersiveSticky,
Expand Down
26 changes: 10 additions & 16 deletions lib/pages/player/player_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,15 @@ class _PlayerItemState extends State<PlayerItem> {

@override
Widget build(BuildContext context) {
return Column(
children: [
Observer(builder: (context) {
return Expanded(
child: playerController.dataStatus == 'loaded'
? AspectRatio(
aspectRatio: playerController.mediaPlayer.value.aspectRatio,
child: VideoPlayer(
playerController.mediaPlayer,
),
)
: const Center(child: CircularProgressIndicator()),
);
}),
],
);
return Observer(builder: (context) {
return playerController.dataStatus == 'loaded'
? AspectRatio(
aspectRatio: playerController.mediaPlayer.value.aspectRatio,
child: VideoPlayer(
playerController.mediaPlayer,
),
)
: const Center(child: CircularProgressIndicator());
});
}
}

0 comments on commit e2befcd

Please sign in to comment.