refa: video (#1555)

* refa: video [skip ci]

* fix: scroll [skip ci]

* mod: only left click

* downgrade

* refa: background play & wakelock [skip ci]

* fix: subtitle [skip ci]

* upgrade deps

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* mod: long press

* tweak

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* fix [skip ci]

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* use right pos

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* delay showing

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* fix: null danmaku

* remove

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

---------

Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
My-Responsitories
2025-10-14 17:05:31 +08:00
committed by GitHub
parent 4cf1c25b36
commit 9d747c8e2c
15 changed files with 1071 additions and 313 deletions

View File

@@ -131,7 +131,6 @@ class _PlDanmakuState extends State<PlDanmaku> {
e.colorful == DmColorfulType.VipGradualColor,
count: e.hasCount() ? e.count : null,
selfSend: e.isSelf,
extra: VideoDanmaku(id: e.id.toInt(), mid: e.midHash),
),
);
}

View File

@@ -371,11 +371,6 @@ class LiveRoomController extends GetxController {
: DmUtils.decimalToColor(extra['color']),
type: DmUtils.getPosition(extra['mode']),
selfSend: extra['send_from_me'] ?? false,
extra: LiveDanmaku(
id: extra['id_str'],
mid: uid,
uname: user['base']['name'],
),
),
);
if (!disableAutoScroll.value) {

View File

@@ -211,8 +211,8 @@ class _LiveRoomPageState extends State<LiveRoomPage>
required double width,
required double height,
bool isPipMode = false,
Color? fill,
Alignment? alignment,
Color fill = Colors.black,
Alignment alignment = Alignment.center,
bool needDm = true,
}) {
if (!isFullScreen && !plPlayerController.isDesktopPip) {
@@ -472,7 +472,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
height: videoHeight,
isFullScreen,
needDm: isFullScreen,
alignment: isFullScreen ? null : Alignment.topCenter,
alignment: isFullScreen ? Alignment.center : Alignment.topCenter,
),
),
Positioned(

View File

@@ -29,13 +29,6 @@ List<SettingsModel> get playSettings => [
setKey: SettingBoxKey.enableShowDanmaku,
defaultVal: true,
),
// const SettingsModel(
// settingsType: SettingsType.sw1tch,
// title: '启用点击弹幕',
// leading: Icon(Icons.touch_app_outlined),
// setKey: SettingBoxKey.enableTapDm,
// defaultVal: false,
// ),
SettingsModel(
settingsType: SettingsType.normal,
onTap: (setState) => Get.toNamed('/playSpeedSet'),

View File

@@ -165,17 +165,18 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
late final ctr = videoDetailController.plPlayerController;
if (state == AppLifecycleState.resumed) {
if (!videoDetailController.plPlayerController.showDanmaku) {
if (!ctr.showDanmaku) {
introController.startTimer();
videoDetailController.plPlayerController.showDanmaku = true;
ctr.showDanmaku = true;
// 修复从后台恢复时全屏状态下屏幕方向错误的问题
if (isFullScreen && Platform.isIOS) {
WidgetsBinding.instance.addPostFrameCallback((_) {
// 根据视频方向重新设置屏幕方向
final isVertical = videoDetailController.isVertical.value;
final mode = plPlayerController?.mode;
final mode = ctr.mode;
if (!(mode == FullScreenMode.vertical ||
(mode == FullScreenMode.auto && isVertical) ||
@@ -188,7 +189,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
}
} else if (state == AppLifecycleState.paused) {
introController.canelTimer();
videoDetailController.plPlayerController.showDanmaku = false;
ctr.showDanmaku = false;
}
}

View File

@@ -10,6 +10,7 @@ import 'package:PiliPlus/common/widgets/dialog/report.dart';
import 'package:PiliPlus/common/widgets/marquee.dart';
import 'package:PiliPlus/http/danmaku.dart';
import 'package:PiliPlus/http/danmaku_block.dart';
import 'package:PiliPlus/http/init.dart';
import 'package:PiliPlus/models/common/super_resolution_type.dart';
import 'package:PiliPlus/models/common/video/audio_quality.dart';
import 'package:PiliPlus/models/common/video/cdn_type.dart';
@@ -30,6 +31,7 @@ import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
import 'package:PiliPlus/services/service_locator.dart';
import 'package:PiliPlus/utils/accounts.dart';
import 'package:PiliPlus/utils/accounts/account.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/image_utils.dart';
import 'package:PiliPlus/utils/page_utils.dart';
@@ -987,16 +989,19 @@ class HeaderControlState extends State<HeaderControl> {
onTap: () async {
Get.back();
try {
final res = await Dio().get(
final res = await Request.dio.get<Uint8List>(
item.subtitleUrl!.http2https,
options: Options(responseType: ResponseType.bytes),
options: Options(
responseType: ResponseType.bytes,
extra: {'account': const NoAccount()},
),
);
if (res.statusCode == 200) {
final Uint8List bytes = res.data;
final bytes = res.data!;
final name =
'${introController.videoDetail.value.title}-${videoDetailCtr.bvid}-${videoDetailCtr.cid.value}-${item.lanDoc}.json';
final path = await FilePicker.platform.saveFile(
allowedExtensions: ['json'],
allowedExtensions: const ['json'],
type: FileType.custom,
fileName: name,
bytes: Utils.isDesktop ? null : bytes,