fix: 画面比例改变无法立即生效,删除冗余代码

This commit is contained in:
orz12
2024-03-06 10:46:33 +08:00
parent b53b99de2f
commit 2a9431e4b6
2 changed files with 1 additions and 4 deletions

View File

@@ -81,7 +81,6 @@ class PlPlayerController {
final Rx<String> _direction = 'horizontal'.obs; final Rx<String> _direction = 'horizontal'.obs;
Rx<bool> videoFitChanged = false.obs;
final Rx<BoxFit> _videoFit = Rx(BoxFit.contain); final Rx<BoxFit> _videoFit = Rx(BoxFit.contain);
final Rx<String> _videoFitDesc = Rx('包含'); final Rx<String> _videoFitDesc = Rx('包含');
@@ -106,7 +105,6 @@ class PlPlayerController {
Timer? _timerForShowingVolume; Timer? _timerForShowingVolume;
Timer? _timerForGettingVolume; Timer? _timerForGettingVolume;
Timer? timerForTrackingMouse; Timer? timerForTrackingMouse;
Timer? videoFitChangedTimer;
// final Durations durations; // final Durations durations;
@@ -1028,7 +1026,6 @@ class PlPlayerController {
_timerForGettingVolume?.cancel(); _timerForGettingVolume?.cancel();
timerForTrackingMouse?.cancel(); timerForTrackingMouse?.cancel();
_timerForSeek?.cancel(); _timerForSeek?.cancel();
videoFitChangedTimer?.cancel();
} }
// 记录播放记录 // 记录播放记录
@@ -1079,7 +1076,6 @@ class PlPlayerController {
_timerForGettingVolume?.cancel(); _timerForGettingVolume?.cancel();
timerForTrackingMouse?.cancel(); timerForTrackingMouse?.cancel();
_timerForSeek?.cancel(); _timerForSeek?.cancel();
videoFitChangedTimer?.cancel();
// _position.close(); // _position.close();
_playerEventSubs?.cancel(); _playerEventSubs?.cancel();
// _sliderPosition.close(); // _sliderPosition.close();

View File

@@ -223,6 +223,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
children: <Widget>[ children: <Widget>[
Obx( Obx(
() => Video( () => Video(
key: ValueKey(_.videoFit.value),
controller: videoController, controller: videoController,
controls: NoVideoControls, controls: NoVideoControls,
pauseUponEnteringBackgroundMode: !enableBackgroundPlay, pauseUponEnteringBackgroundMode: !enableBackgroundPlay,