mod: 立即保存弹幕选项

This commit is contained in:
orz12
2024-03-06 19:18:47 +08:00
parent f6d04b929d
commit 6f4ea3c428
2 changed files with 15 additions and 7 deletions

View File

@@ -1081,6 +1081,15 @@ class PlPlayerController {
videoStorage.put(VideoBoxKey.playRepeat, type.value);
}
void putDanmakuSettings() {
localCache.put(LocalCacheKey.danmakuBlockType, blockTypes);
localCache.put(LocalCacheKey.danmakuShowArea, showArea);
localCache.put(LocalCacheKey.danmakuOpacity, opacityVal);
localCache.put(LocalCacheKey.danmakuFontScale, fontSizeVal);
localCache.put(LocalCacheKey.danmakuDuration, danmakuDurationVal);
localCache.put(LocalCacheKey.strokeWidth, strokeWidth);
}
Future<void> dispose({String type = 'single'}) async {
// 每次减1最后销毁
if (type == 'single' && playerCount.value > 1) {
@@ -1109,13 +1118,6 @@ class PlPlayerController {
// playerStatus.status.close();
// dataStatus.status.close();
/// 缓存本次弹幕选项
localCache.put(LocalCacheKey.danmakuBlockType, blockTypes);
localCache.put(LocalCacheKey.danmakuShowArea, showArea);
localCache.put(LocalCacheKey.danmakuOpacity, opacityVal);
localCache.put(LocalCacheKey.danmakuFontScale, fontSizeVal);
localCache.put(LocalCacheKey.danmakuDuration, danmakuDurationVal);
localCache.put(LocalCacheKey.strokeWidth, strokeWidth);
if (_videoPlayerController != null) {
var pp = _videoPlayerController!.platform as NativePlayer;
await pp.setProperty('audio-files', '');