mod: 代码整理

This commit is contained in:
orz12
2024-02-29 20:58:49 +08:00
parent 57e879ae9f
commit 1d6b3049d9

View File

@@ -282,8 +282,7 @@ class PlPlayerController {
danmakuDurationVal =
localCache.get(LocalCacheKey.danmakuDuration, defaultValue: 4.0);
// 描边粗细
strokeWidth =
localCache.get(LocalCacheKey.strokeWidth, defaultValue: 1.5);
strokeWidth = localCache.get(LocalCacheKey.strokeWidth, defaultValue: 1.5);
playRepeat = PlayRepeat.values.toList().firstWhere(
(e) =>
e.value ==
@@ -377,7 +376,9 @@ class PlPlayerController {
// 获取视频时长 00:00
_duration.value = duration ?? _videoPlayerController!.state.duration;
updateDurationSecond();
if (videoType.value != 'live') {
refreshSubtitles();
}
// 数据加载完成
dataStatus.status.value = DataStatus.loaded;
@@ -433,7 +434,10 @@ class PlPlayerController {
await pp.setProperty("volume-max", "100");
await pp.setProperty("ao", "audiotrack,opensles");
}
// // vo=gpu-next & gpu-context=android & gpu-api=opengl
// await pp.setProperty("vo", "gpu-next");
// await pp.setProperty("gpu-context", "android");
// await pp.setProperty("gpu-api", "opengl");
await player.setAudioTrack(
AudioTrack.auto(),
);
@@ -950,8 +954,10 @@ class PlPlayerController {
if (!isFullScreen.value && status) {
// StatusBarControl.setHidden(true, animation: StatusBarAnimation.FADE);
hideStatusBar();
/// 按照视频宽高比决定全屏方向
toggleFullScreen(true);
/// 进入全屏
FullScreenMode mode = FullScreenModeCode.fromCode(
setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!;
@@ -1086,8 +1092,7 @@ class PlPlayerController {
void refreshSubtitles() async {
_vttSubtitles.clear();
Map res = await VideoHttp.subtitlesJson(
bvid: _bvid, cid: _cid);
Map res = await VideoHttp.subtitlesJson(bvid: _bvid, cid: _cid);
if (!res["status"]) {
SmartDialog.showToast('查询字幕错误,${res["msg"]}');
}
@@ -1153,12 +1158,10 @@ class PlPlayerController {
// 设定字幕轨道
setSubtitle(Map<String, String> s) {
_videoPlayerController?.setSubtitleTrack(
SubtitleTrack.data(
_videoPlayerController?.setSubtitleTrack(SubtitleTrack.data(
s['text']!,
title: s['title']!,
language: s['language']!,
)
);
));
}
}