feat: danmaku chart (#192)

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
dom
2025-01-31 11:36:05 +08:00
committed by GitHub
parent 58a7cf1e75
commit 7ba9646d38
9 changed files with 223 additions and 78 deletions

View File

@@ -461,6 +461,7 @@ class PlPlayerController {
List<Map<String, String>>? vttSubtitles,
int? vttSubtitlesIndex,
bool? showVP,
List? dmTrend,
bool autoplay = true,
// 默认不循环
PlaylistMode looping = PlaylistMode.none,
@@ -493,6 +494,7 @@ class PlPlayerController {
this.vttSubtitles.value = vttSubtitles ?? <Map<String, String>>[];
this.vttSubtitlesIndex.value = vttSubtitlesIndex ?? 0;
this.showVP.value = showVP ?? true;
this.dmTrend.value = dmTrend ?? [];
_autoPlay = autoplay;
_looping = looping;
// 初始化视频倍速
@@ -1581,23 +1583,30 @@ class PlPlayerController {
return;
}
_isQueryingVideoShot = true;
dynamic res = await Request().get(
'https://api.bilibili.com/x/player/videoshot',
queryParameters: {
// 'aid': IdUtils.bv2av(_bvid),
'bvid': _bvid,
'cid': _cid,
'index': 1,
},
);
if (res.data['code'] == 0) {
videoShot = {
'status': true,
'data': res.data['data'],
};
} else {
videoShot = {'status': false};
try {
dynamic res = await Request().get(
'https://api.bilibili.com/x/player/videoshot',
queryParameters: {
// 'aid': IdUtils.bv2av(_bvid),
'bvid': _bvid,
'cid': _cid,
'index': 1,
},
);
if (res.data['code'] == 0) {
videoShot = {
'status': true,
'data': res.data['data'],
};
} else {
videoShot = {'status': false};
}
} catch (e) {
debugPrint('getVideoShot: $e');
}
_isQueryingVideoShot = false;
}
late final RxList dmTrend = [].obs;
late final RxBool showDmChart = true.obs;
}