opt: 梳理逻辑

This commit is contained in:
orz12
2023-12-24 02:55:50 +08:00
parent c7611e436f
commit 022b3580dc
2 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,6 @@ import 'package:pilipala/plugin/pl_player/index.dart';
class PlDanmakuController {
PlDanmakuController(this.cid);
final int cid;
late Duration videoDuration;
Map<int,List<DanmakuElem>> dmSegMap = {};
// 已请求的段落标记
List<bool> requestedSeg = [];
@ -14,9 +13,9 @@ class PlDanmakuController {
static int SEGMENT_LENGTH = 60 * 6 * 1000;
void initiate(int progress) {
void initiate(int videoDuration, int progress) {
if (requestedSeg.isEmpty) {
int segCount = (videoDuration.inSeconds / (60 * 6)).ceil();
int segCount = (videoDuration / SEGMENT_LENGTH).ceil();
requestedSeg = List<bool>.generate(segCount, (index) => false);
}
queryDanmaku(