Merge branch 'fix'

This commit is contained in:
guozhigq
2024-07-03 23:47:40 +08:00

View File

@ -17,7 +17,11 @@ class PlDanmakuController {
int segCount = (videoDuration / segmentLength).ceil(); int segCount = (videoDuration / segmentLength).ceil();
requestedSeg = List<bool>.generate(segCount, (index) => false); requestedSeg = List<bool>.generate(segCount, (index) => false);
} }
try {
queryDanmaku(calcSegment(progress)); queryDanmaku(calcSegment(progress));
} catch (e) {
print(e);
}
} }
void dispose() { void dispose() {
@ -31,6 +35,7 @@ class PlDanmakuController {
void queryDanmaku(int segmentIndex) async { void queryDanmaku(int segmentIndex) async {
assert(requestedSeg[segmentIndex] == false); assert(requestedSeg[segmentIndex] == false);
if (requestedSeg.length > segmentIndex) {
requestedSeg[segmentIndex] = true; requestedSeg[segmentIndex] = true;
final DmSegMobileReply result = await DanmakaHttp.queryDanmaku( final DmSegMobileReply result = await DanmakaHttp.queryDanmaku(
cid: cid, segmentIndex: segmentIndex + 1); cid: cid, segmentIndex: segmentIndex + 1);
@ -44,6 +49,7 @@ class PlDanmakuController {
} }
} }
} }
}
List<DanmakuElem>? getCurrentDanmaku(int progress) { List<DanmakuElem>? getCurrentDanmaku(int progress) {
int segmentIndex = calcSegment(progress); int segmentIndex = calcSegment(progress);