Merge branch 'fix' into alpha

This commit is contained in:
guozhigq
2023-09-04 13:14:52 +08:00
4 changed files with 33 additions and 27 deletions

View File

@ -167,7 +167,13 @@ class VideoDetailController extends GetxController
playerInit();
}
Future playerInit({video, audio, seekToTime, duration}) async {
Future playerInit({
video,
audio,
seekToTime,
duration,
bool autoplay = true,
}) async {
/// 设置/恢复 屏幕亮度
if (brightness != null) {
ScreenBrightness().setScreenBrightness(brightness!);
@ -199,6 +205,7 @@ class VideoDetailController extends GetxController
cid: cid,
enableHeart: enableHeart,
isFirstTime: isFirstTime,
autoplay: autoplay,
);
}

View File

@ -102,6 +102,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
plPlayerController!.play();
}
/// 未开启自动播放时触发播放
Future<void> handlePlay() async {
await videoDetailController.playerInit();
plPlayerController = videoDetailController.plPlayerController;
@ -111,8 +112,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
@override
void dispose() {
plPlayerController!.removeStatusLister(playerListener);
plPlayerController!.dispose();
if (plPlayerController != null) {
plPlayerController!.removeStatusLister(playerListener);
plPlayerController!.dispose();
}
super.dispose();
}
@ -134,9 +137,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
// 返回当前页面时
void didPopNext() async {
videoDetailController.isFirstTime = false;
videoDetailController.playerInit();
bool autoplay =
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
videoDetailController.playerInit(autoplay: autoplay);
videoDetailController.autoPlay.value = true;
videoIntroController.isPaused = false;
if (_extendNestCtr.position.pixels == 0) {
if (_extendNestCtr.position.pixels == 0 && autoplay) {
await Future.delayed(const Duration(milliseconds: 300));
plPlayerController!.play();
}

View File

@ -756,6 +756,9 @@ class PlPlayerController {
if (videoType.value == 'live') {
return;
}
if (controlsLock.value) {
return;
}
_doubleSpeedStatus.value = val;
double currentSpeed = playbackSpeed;
if (val) {

View File

@ -239,35 +239,25 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
() => Align(
alignment: Alignment.topCenter,
child: FractionalTranslation(
translation: const Offset(0.0, 1), // 上下偏移量(负数向上偏移)
translation: const Offset(0.0, 0.3), // 上下偏移量(负数向上偏移)
child: AnimatedOpacity(
curve: Curves.easeInOut,
opacity: _.doubleSpeedStatus.value ? 1.0 : 0.0,
duration: const Duration(milliseconds: 150),
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: const Color(0x88000000),
borderRadius: BorderRadius.circular(64.0),
),
height: 34.0,
width: 86.0,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(width: 3),
Image.asset(
'assets/images/run-pokemon.gif',
height: 20,
),
const Text(
alignment: Alignment.center,
decoration: BoxDecoration(
color: const Color(0x88000000),
borderRadius: BorderRadius.circular(16.0),
),
height: 32.0,
width: 70.0,
child: const Center(
child: Text(
'倍速中',
style: TextStyle(color: Colors.white, fontSize: 12),
style: TextStyle(color: Colors.white, fontSize: 13),
),
const SizedBox(width: 4),
],
),
),
)),
),
),
),