feat: 简单实现弹幕功能

This commit is contained in:
guozhigq
2023-08-29 23:10:22 +08:00
parent 5f730af347
commit dfbe3b1f6c
23 changed files with 646 additions and 241 deletions

View File

@ -21,6 +21,7 @@ class VideoDetailController extends GetxController
/// 路由传参
String bvid = Get.parameters['bvid']!;
int cid = int.parse(Get.parameters['cid']!);
RxInt danmakuCid = 0.obs;
String heroTag = Get.arguments['heroTag'];
// 视频详情
Map videoItem = {};
@ -73,6 +74,7 @@ class VideoDetailController extends GetxController
// 默认记录历史记录
bool enableHeart = true;
var userInfo;
late bool isFirstTime = true;
@override
void onInit() {
@ -100,6 +102,7 @@ class VideoDetailController extends GetxController
localCache.get(LocalCacheKey.historyPause) == true) {
enableHeart = false;
}
danmakuCid.value = cid;
}
showReplyReplyPanel() {
@ -193,6 +196,7 @@ class VideoDetailController extends GetxController
bvid: bvid,
cid: cid,
enableHeart: enableHeart,
isFirstTime: isFirstTime,
);
}
@ -233,7 +237,6 @@ class VideoDetailController extends GetxController
currentDecodeFormats = VideoDecodeFormatsCode.fromString(setting.get(
SettingBoxKey.defaultDecode,
defaultValue: VideoDecodeFormats.values.last.code))!;
print(currentDecodeFormats.description);
try {
// 当前视频没有对应格式返回第一个
bool flag = false;
@ -287,6 +290,7 @@ class VideoDetailController extends GetxController
defaultST = Duration(milliseconds: data.lastPlayTime!);
if (autoPlay.value) {
await playerInit();
isShowCover.value = false;
}
} else {
if (result['code'] == -404) {