mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 补全弹幕关键词过滤
This commit is contained in:
@@ -74,7 +74,7 @@ class Rule {
|
|||||||
class SimpleRule {
|
class SimpleRule {
|
||||||
final int id;
|
final int id;
|
||||||
final int type;
|
final int type;
|
||||||
final String filter;
|
String filter;
|
||||||
SimpleRule(this.id, this.type, this.filter);
|
SimpleRule(this.id, this.type, this.filter);
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ import 'package:PiliPalaX/models/danmaku/dm.pb.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
class PlDanmakuController {
|
class PlDanmakuController {
|
||||||
PlDanmakuController(this.cid, this.danmakuWeightNotifier);
|
PlDanmakuController(this.cid, this.danmakuWeightNotifier, this.danmakuFilterNotifier);
|
||||||
final int cid;
|
final int cid;
|
||||||
final ValueNotifier<int> danmakuWeightNotifier;
|
final ValueNotifier<int> danmakuWeightNotifier;
|
||||||
|
final ValueNotifier<List<Map<String, dynamic>>> danmakuFilterNotifier;
|
||||||
int danmakuWeight = 0;
|
int danmakuWeight = 0;
|
||||||
|
List<Map<String, dynamic>> danmakuFilter = [];
|
||||||
Map<int, List<DanmakuElem>> dmSegMap = {};
|
Map<int, List<DanmakuElem>> dmSegMap = {};
|
||||||
// 已请求的段落标记
|
// 已请求的段落标记
|
||||||
List<bool> requestedSeg = [];
|
List<bool> requestedSeg = [];
|
||||||
@@ -24,6 +26,10 @@ class PlDanmakuController {
|
|||||||
"danmakuWeight changed from $danmakuWeight to ${danmakuWeightNotifier.value}");
|
"danmakuWeight changed from $danmakuWeight to ${danmakuWeightNotifier.value}");
|
||||||
danmakuWeight = danmakuWeightNotifier.value;
|
danmakuWeight = danmakuWeightNotifier.value;
|
||||||
});
|
});
|
||||||
|
danmakuFilterNotifier.addListener(() {
|
||||||
|
print("danmakuFilter changed from $danmakuFilter to ${danmakuFilterNotifier.value}");
|
||||||
|
danmakuFilter = danmakuFilterNotifier.value;
|
||||||
|
});
|
||||||
if (requestedSeg.isEmpty) {
|
if (requestedSeg.isEmpty) {
|
||||||
int segCount = (videoDuration / segmentLength).ceil();
|
int segCount = (videoDuration / segmentLength).ceil();
|
||||||
requestedSeg = List<bool>.generate(segCount, (index) => false);
|
requestedSeg = List<bool>.generate(segCount, (index) => false);
|
||||||
@@ -32,6 +38,9 @@ class PlDanmakuController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
danmakuWeightNotifier.removeListener(() {});
|
||||||
|
danmakuFilterNotifier.removeListener(() {});
|
||||||
|
danmakuFilter.clear();
|
||||||
dmSegMap.clear();
|
dmSegMap.clear();
|
||||||
requestedSeg.clear();
|
requestedSeg.clear();
|
||||||
}
|
}
|
||||||
@@ -67,13 +76,36 @@ class PlDanmakuController {
|
|||||||
if (!requestedSeg[segmentIndex]) {
|
if (!requestedSeg[segmentIndex]) {
|
||||||
queryDanmaku(segmentIndex);
|
queryDanmaku(segmentIndex);
|
||||||
}
|
}
|
||||||
if (danmakuWeight == 0) {
|
if (danmakuWeight == 0 && danmakuFilter.isEmpty) {
|
||||||
return dmSegMap[progress ~/ 100];
|
return dmSegMap[progress ~/ 100];
|
||||||
} else {
|
} else {
|
||||||
//using filter
|
|
||||||
return dmSegMap[progress ~/ 100]
|
return dmSegMap[progress ~/ 100]
|
||||||
?.where((element) => element.weight >= danmakuWeight)
|
?.where((element) => element.weight >= danmakuWeight)
|
||||||
|
.where(filterDanmaku)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool filterDanmaku(DanmakuElem elem) {
|
||||||
|
for (var filter in danmakuFilter) {
|
||||||
|
switch (filter['type']) {
|
||||||
|
case 0:
|
||||||
|
if (elem.content.contains(filter['filter'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (RegExp(filter['filter']).hasMatch(elem.content)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (elem.idStr == filter['filter']) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
enableShowDanmaku =
|
enableShowDanmaku =
|
||||||
setting.get(SettingBoxKey.enableShowDanmaku, defaultValue: false);
|
setting.get(SettingBoxKey.enableShowDanmaku, defaultValue: false);
|
||||||
_plDanmakuController = PlDanmakuController(
|
_plDanmakuController = PlDanmakuController(
|
||||||
widget.cid, widget.playerController.danmakuWeight);
|
widget.cid,
|
||||||
|
widget.playerController.danmakuWeight,
|
||||||
|
widget.playerController.danmakuFilterRule);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
playerController = widget.playerController;
|
playerController = widget.playerController;
|
||||||
if (enableShowDanmaku || playerController.isOpenDanmu.value) {
|
if (enableShowDanmaku || playerController.isOpenDanmu.value) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:PiliPalaX/utils/storage.dart';
|
|||||||
|
|
||||||
import '../../http/danmaku_block.dart';
|
import '../../http/danmaku_block.dart';
|
||||||
import '../../models/user/danmaku_block.dart';
|
import '../../models/user/danmaku_block.dart';
|
||||||
|
import '../../plugin/pl_player/controller.dart';
|
||||||
|
|
||||||
class DanmakuBlockPage extends StatefulWidget {
|
class DanmakuBlockPage extends StatefulWidget {
|
||||||
const DanmakuBlockPage({super.key});
|
const DanmakuBlockPage({super.key});
|
||||||
@@ -19,71 +20,143 @@ class _DanmakuBlockPageState extends State<DanmakuBlockPage> {
|
|||||||
Get.put(DanmakuBlockController());
|
Get.put(DanmakuBlockController());
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
|
late PlPlayerController plPlayerController;
|
||||||
|
|
||||||
|
static const Map<int, String> ruleLabels = {
|
||||||
|
0: '关键词',
|
||||||
|
1: '正则',
|
||||||
|
2: '用户',
|
||||||
|
};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_danmakuBlockController.queryDanmakuFilter();
|
_danmakuBlockController.queryDanmakuFilter();
|
||||||
|
});
|
||||||
|
plPlayerController = Get.arguments as PlPlayerController;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
List<Map<String, dynamic>> simpleRuleList =
|
List<Map<String, dynamic>> simpleRuleList = _danmakuBlockController
|
||||||
_danmakuBlockController.danmakuRules.map<Map<String, dynamic>>((e) {
|
.ruleTypes.values
|
||||||
return SimpleRule(e.id!, e.type!, e.filter!).toMap();
|
.expand((element) => element)
|
||||||
|
.map<Map<String, dynamic>>((e) {
|
||||||
|
//当正则表达式前后都有"/"时,去掉,避免RegExp解析错误
|
||||||
|
if (e.type == 1 && e.filter.startsWith('/') && e.filter.endsWith('/')) {
|
||||||
|
e.filter = e.filter.substring(1, e.filter.length - 1);
|
||||||
|
}
|
||||||
|
return e.toMap();
|
||||||
}).toList();
|
}).toList();
|
||||||
|
print("simpleRuleList:$simpleRuleList");
|
||||||
setting.put(SettingBoxKey.danmakuFilterRule, simpleRuleList);
|
setting.put(SettingBoxKey.danmakuFilterRule, simpleRuleList);
|
||||||
|
plPlayerController.danmakuFilterRule.value = simpleRuleList;
|
||||||
scrollController.removeListener(() {});
|
scrollController.removeListener(() {});
|
||||||
|
scrollController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showAddDialog(int type) {
|
||||||
|
final TextEditingController textController = TextEditingController();
|
||||||
|
late String hintText;
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
hintText = '输入过滤的关键词,其它类别请切换标签页后添加';
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
hintText = '输入//之间的正则表达式,无需包含头尾的"/"';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
hintText = '输入经CRC32B(即小写16进制的CRC32)哈希后的用户UID';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('添加新的${ruleLabels[type]}规则'),
|
||||||
|
content: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||||
|
Text(hintText),
|
||||||
|
TextField(
|
||||||
|
controller: textController,
|
||||||
|
//decoration: InputDecoration(hintText: hintText),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('取消'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: const Text('添加'),
|
||||||
|
onPressed: () async {
|
||||||
|
String filter = textController.text;
|
||||||
|
if (filter.isNotEmpty) {
|
||||||
|
await _danmakuBlockController.danmakuFilterAdd(
|
||||||
|
filter: filter, type: type);
|
||||||
|
if (!context.mounted) return;
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast('输入内容不能为空');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Obx(
|
title: TabBar(
|
||||||
() => TabBar(
|
|
||||||
controller: _danmakuBlockController.tabController,
|
controller: _danmakuBlockController.tabController,
|
||||||
dividerColor: Colors.transparent,
|
dividerColor: Colors.transparent,
|
||||||
tabs: [
|
tabs: [
|
||||||
Tab(text: '文本(${_danmakuBlockController.textRules.length})'),
|
for (var i = 0; i < ruleLabels.length; i++)
|
||||||
Tab(text: '正则(${_danmakuBlockController.regexRules.length})'),
|
Obx(() => Tab(
|
||||||
Tab(text: '用户(${_danmakuBlockController.userRules.length})'),
|
text:
|
||||||
],
|
'${ruleLabels[i]}(${_danmakuBlockController.ruleTypes[i]!.length})')),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
),
|
body: TabBarView(
|
||||||
),
|
|
||||||
body: RefreshIndicator(
|
|
||||||
onRefresh: () async =>
|
|
||||||
await _danmakuBlockController.queryDanmakuFilter(),
|
|
||||||
child: TabBarView(
|
|
||||||
controller: _danmakuBlockController.tabController,
|
controller: _danmakuBlockController.tabController,
|
||||||
children: [
|
children: [
|
||||||
Obx(() => tabViewBuilder(0, _danmakuBlockController.textRules)),
|
for (var i = 0; i < ruleLabels.length; i++)
|
||||||
Obx(() => tabViewBuilder(1, _danmakuBlockController.regexRules)),
|
Obx(() => tabViewBuilder(i, _danmakuBlockController.ruleTypes[i]!)),
|
||||||
Obx(() => tabViewBuilder(2, _danmakuBlockController.userRules)),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () {
|
||||||
|
_showAddDialog(_danmakuBlockController.tabController.index);
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.add),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Widget tabViewBuilder(int index, List<SimpleRule> list) {
|
|
||||||
|
Widget tabViewBuilder(int tabIndex, List<SimpleRule> list) {
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
itemCount: list.length,
|
itemCount: list.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
padding: const EdgeInsets.only(bottom: 100),
|
||||||
|
itemBuilder: (BuildContext context, int listIndex) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
list[index].filter,
|
list[listIndex].filter,
|
||||||
style: Theme.of(context).textTheme.subtitle1,
|
style: Theme.of(context).textTheme.subtitle1,
|
||||||
),
|
),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
icon: const Icon(Icons.delete),
|
icon: const Icon(Icons.delete),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await _danmakuBlockController.danmakuFilterDel(
|
await _danmakuBlockController.danmakuFilterDel(
|
||||||
1, list[index].id);
|
tabIndex, list[listIndex].id);
|
||||||
},
|
}),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -93,9 +166,11 @@ class _DanmakuBlockPageState extends State<DanmakuBlockPage> {
|
|||||||
class DanmakuBlockController extends GetxController
|
class DanmakuBlockController extends GetxController
|
||||||
with GetTickerProviderStateMixin {
|
with GetTickerProviderStateMixin {
|
||||||
RxList<Rule> danmakuRules = <Rule>[].obs;
|
RxList<Rule> danmakuRules = <Rule>[].obs;
|
||||||
RxList<SimpleRule> textRules = <SimpleRule>[].obs;
|
RxMap<int, List<SimpleRule>> ruleTypes = {
|
||||||
RxList<SimpleRule> regexRules = <SimpleRule>[].obs;
|
0: <SimpleRule>[],
|
||||||
RxList<SimpleRule> userRules = <SimpleRule>[].obs;
|
1: <SimpleRule>[],
|
||||||
|
2: <SimpleRule>[],
|
||||||
|
}.obs;
|
||||||
late TabController tabController;
|
late TabController tabController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -111,45 +186,31 @@ class DanmakuBlockController extends GetxController
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future queryDanmakuFilter() async {
|
Future queryDanmakuFilter() async {
|
||||||
|
SmartDialog.showLoading(msg: '正在同步弹幕屏蔽规则……');
|
||||||
var result = await DanmakuFilterHttp.danmakuFilter();
|
var result = await DanmakuFilterHttp.danmakuFilter();
|
||||||
|
SmartDialog.dismiss();
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
danmakuRules.value = result['data'].rule;
|
danmakuRules.value = result['data'].rule;
|
||||||
danmakuRules.map((e) {
|
danmakuRules.map((e) {
|
||||||
SimpleRule simpleRule = SimpleRule(e.id!, e.type!, e.filter!);
|
SimpleRule simpleRule = SimpleRule(e.id!, e.type!, e.filter!);
|
||||||
switch (e.type!) {
|
ruleTypes[e.type!]!.add(simpleRule);
|
||||||
case 0:
|
|
||||||
textRules.add(simpleRule);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
regexRules.add(simpleRule);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
userRules.add(simpleRule);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
SmartDialog.showToast('未知的规则类型:${e.type},内容为:${e.filter}');
|
|
||||||
}
|
|
||||||
}).toList();
|
}).toList();
|
||||||
|
ruleTypes.refresh();
|
||||||
SmartDialog.showToast(result['data'].toast);
|
SmartDialog.showToast(result['data'].toast);
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast(result['msg']);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future danmakuFilterDel(int type, int id) async {
|
Future danmakuFilterDel(int type, int id) async {
|
||||||
|
SmartDialog.showLoading(msg: '正在删除弹幕屏蔽规则……');
|
||||||
var result = await DanmakuFilterHttp.danmakuFilterDel(ids: id);
|
var result = await DanmakuFilterHttp.danmakuFilterDel(ids: id);
|
||||||
|
SmartDialog.dismiss();
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
danmakuRules.removeWhere((e) => e.id == id);
|
danmakuRules.removeWhere((e) => e.id == id);
|
||||||
switch (type) {
|
ruleTypes[type]!.removeWhere((e) => e.id == id);
|
||||||
case 0:
|
ruleTypes.refresh();
|
||||||
textRules.removeWhere((e) => e.id == id);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
regexRules.removeWhere((e) => e.id == id);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
userRules.removeWhere((e) => e.id == id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
@@ -157,23 +218,16 @@ class DanmakuBlockController extends GetxController
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future danmakuFilterAdd({required String filter, required int type}) async {
|
Future danmakuFilterAdd({required String filter, required int type}) async {
|
||||||
|
SmartDialog.showLoading(msg: '正在添加弹幕屏蔽规则……');
|
||||||
var result =
|
var result =
|
||||||
await DanmakuFilterHttp.danmakuFilterAdd(filter: filter, type: type);
|
await DanmakuFilterHttp.danmakuFilterAdd(filter: filter, type: type);
|
||||||
|
SmartDialog.dismiss();
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
Rule data = result['data'];
|
Rule data = result['data'];
|
||||||
danmakuRules.add(data);
|
danmakuRules.add(data);
|
||||||
SimpleRule simpleRule = SimpleRule(data.id!, data.type!, data.filter!);
|
SimpleRule simpleRule = SimpleRule(data.id!, data.type!, data.filter!);
|
||||||
switch (data.type!) {
|
ruleTypes[type]!.add(simpleRule);
|
||||||
case 0:
|
ruleTypes.refresh();
|
||||||
textRules.add(simpleRule);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
regexRules.add(simpleRule);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
userRules.add(simpleRule);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
SmartDialog.showToast('添加成功');
|
SmartDialog.showToast('添加成功');
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
|
|||||||
@@ -774,8 +774,13 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
minimumSize: Size.zero,
|
minimumSize: Size.zero,
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
),
|
),
|
||||||
onPressed: () => Get.toNamed('/danmakuBlock'),
|
onPressed: () => {
|
||||||
child: const Text("屏蔽管理"))
|
Get.back(),
|
||||||
|
Get.toNamed('/danmakuBlock',
|
||||||
|
arguments: widget.controller)
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
"屏蔽管理(${widget.controller!.danmakuFilterRule.value.length})")),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
|||||||
@@ -235,6 +235,8 @@ class PlPlayerController {
|
|||||||
|
|
||||||
/// 弹幕权重
|
/// 弹幕权重
|
||||||
ValueNotifier<int> danmakuWeight = ValueNotifier(0);
|
ValueNotifier<int> danmakuWeight = ValueNotifier(0);
|
||||||
|
ValueNotifier<List<Map<String, dynamic>>> danmakuFilterRule =
|
||||||
|
ValueNotifier([]);
|
||||||
// 关联弹幕控制器
|
// 关联弹幕控制器
|
||||||
DanmakuController? danmakuController;
|
DanmakuController? danmakuController;
|
||||||
// 弹幕相关配置
|
// 弹幕相关配置
|
||||||
@@ -287,6 +289,10 @@ class PlPlayerController {
|
|||||||
setting.get(SettingBoxKey.enableShowDanmaku, defaultValue: false);
|
setting.get(SettingBoxKey.enableShowDanmaku, defaultValue: false);
|
||||||
danmakuWeight.value =
|
danmakuWeight.value =
|
||||||
setting.get(SettingBoxKey.danmakuWeight, defaultValue: 0);
|
setting.get(SettingBoxKey.danmakuWeight, defaultValue: 0);
|
||||||
|
danmakuFilterRule.value = setting.get(SettingBoxKey.danmakuFilterRule,
|
||||||
|
defaultValue: []).map<Map<String, dynamic>>((e) {
|
||||||
|
return Map<String, dynamic>.from(e);
|
||||||
|
}).toList();
|
||||||
blockTypes = setting.get(SettingBoxKey.danmakuBlockType, defaultValue: []);
|
blockTypes = setting.get(SettingBoxKey.danmakuBlockType, defaultValue: []);
|
||||||
showArea = setting.get(SettingBoxKey.danmakuShowArea, defaultValue: 0.5);
|
showArea = setting.get(SettingBoxKey.danmakuShowArea, defaultValue: 0.5);
|
||||||
// 不透明度
|
// 不透明度
|
||||||
@@ -312,8 +318,8 @@ class PlPlayerController {
|
|||||||
enableAutoLongPressSpeed = setting
|
enableAutoLongPressSpeed = setting
|
||||||
.get(SettingBoxKey.enableAutoLongPressSpeed, defaultValue: false);
|
.get(SettingBoxKey.enableAutoLongPressSpeed, defaultValue: false);
|
||||||
// 后台播放
|
// 后台播放
|
||||||
_continuePlayInBackground.value =
|
_continuePlayInBackground.value = setting
|
||||||
setting.get(SettingBoxKey.continuePlayInBackground, defaultValue: false);
|
.get(SettingBoxKey.continuePlayInBackground, defaultValue: false);
|
||||||
if (!enableAutoLongPressSpeed) {
|
if (!enableAutoLongPressSpeed) {
|
||||||
_longPressSpeed.value = videoStorage
|
_longPressSpeed.value = videoStorage
|
||||||
.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 3.0);
|
.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 3.0);
|
||||||
@@ -515,7 +521,7 @@ class PlPlayerController {
|
|||||||
configuration: VideoControllerConfiguration(
|
configuration: VideoControllerConfiguration(
|
||||||
enableHardwareAcceleration: enableHA,
|
enableHardwareAcceleration: enableHA,
|
||||||
androidAttachSurfaceAfterVideoParameters: false,
|
androidAttachSurfaceAfterVideoParameters: false,
|
||||||
hwdec: enableHA ? hwdec: null,
|
hwdec: enableHA ? hwdec : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user