Merge branch 'fix' into alpha
This commit is contained in:
@ -70,36 +70,44 @@ class VideoCardV extends StatelessWidget {
|
||||
break;
|
||||
// 动态
|
||||
case 'picture':
|
||||
String dynamicType = 'picture';
|
||||
String uri = videoItem.uri;
|
||||
if (videoItem.uri.contains('bilibili://article/')) {
|
||||
dynamicType = 'article';
|
||||
RegExp regex = RegExp(r'\d+');
|
||||
Match match = regex.firstMatch(videoItem.uri)!;
|
||||
String matchedNumber = match.group(0)!;
|
||||
videoItem.param = 'cv' + matchedNumber;
|
||||
}
|
||||
if (uri.startsWith('http')) {
|
||||
String path = Uri.parse(uri).path;
|
||||
if (isStringNumeric(path.split('/')[1])) {
|
||||
// 请求接口
|
||||
var res = await DynamicsHttp.dynamicDetail(id: path.split('/')[1]);
|
||||
if (res['status']) {
|
||||
Get.toNamed('/dynamicDetail', arguments: {
|
||||
'item': res['data'],
|
||||
'floor': 1,
|
||||
'action': 'detail'
|
||||
});
|
||||
}
|
||||
return;
|
||||
try {
|
||||
String dynamicType = 'picture';
|
||||
String uri = videoItem.uri;
|
||||
String id = '';
|
||||
if (videoItem.uri.startsWith('bilibili://article/')) {
|
||||
// https://www.bilibili.com/read/cv27063554
|
||||
dynamicType = 'read';
|
||||
RegExp regex = RegExp(r'\d+');
|
||||
Match match = regex.firstMatch(videoItem.uri)!;
|
||||
String matchedNumber = match.group(0)!;
|
||||
videoItem.param = int.parse(matchedNumber);
|
||||
id = 'cv${videoItem.param}';
|
||||
}
|
||||
if (uri.startsWith('http')) {
|
||||
String path = Uri.parse(uri).path;
|
||||
if (isStringNumeric(path.split('/')[1])) {
|
||||
// 请求接口
|
||||
var res =
|
||||
await DynamicsHttp.dynamicDetail(id: path.split('/')[1]);
|
||||
if (res['status']) {
|
||||
Get.toNamed('/dynamicDetail', arguments: {
|
||||
'item': res['data'],
|
||||
'floor': 1,
|
||||
'action': 'detail'
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
Get.toNamed('/htmlRender', parameters: {
|
||||
'url': uri,
|
||||
'title': videoItem.title,
|
||||
'id': id,
|
||||
'dynamicType': dynamicType
|
||||
});
|
||||
} catch (err) {
|
||||
SmartDialog.showToast(err.toString());
|
||||
}
|
||||
Get.toNamed('/htmlRender', parameters: {
|
||||
'url': uri,
|
||||
'title': videoItem.title,
|
||||
'id': videoItem.param.toString(),
|
||||
'dynamicType': dynamicType
|
||||
});
|
||||
break;
|
||||
default:
|
||||
SmartDialog.showToast(videoItem.goto);
|
||||
|
@ -214,6 +214,8 @@ class PlPlayerController {
|
||||
late double fontSizeVal;
|
||||
late double danmakuSpeedVal;
|
||||
late List speedsList;
|
||||
// 缓存
|
||||
double? defaultDuration;
|
||||
|
||||
// 播放顺序相关
|
||||
PlayRepeat playRepeat = PlayRepeat.pause;
|
||||
@ -575,8 +577,9 @@ class PlPlayerController {
|
||||
await _videoPlayerController?.setRate(speed);
|
||||
try {
|
||||
DanmakuOption currentOption = danmakuController!.option;
|
||||
defaultDuration ??= currentOption.duration;
|
||||
DanmakuOption updatedOption = currentOption.copyWith(
|
||||
duration: (currentOption.duration / speed) * playbackSpeed);
|
||||
duration: (defaultDuration! / speed) * playbackSpeed);
|
||||
danmakuController!.updateOption(updatedOption);
|
||||
} catch (_) {}
|
||||
// fix 长按倍速后放开不恢复
|
||||
@ -584,16 +587,16 @@ class PlPlayerController {
|
||||
}
|
||||
|
||||
/// 设置倍速
|
||||
Future<void> togglePlaybackSpeed() async {
|
||||
List<double> allowedSpeeds =
|
||||
PlaySpeed.values.map<double>((e) => e.value).toList();
|
||||
int index = allowedSpeeds.indexOf(_playbackSpeed.value);
|
||||
if (index < allowedSpeeds.length - 1) {
|
||||
setPlaybackSpeed(allowedSpeeds[index + 1]);
|
||||
} else {
|
||||
setPlaybackSpeed(allowedSpeeds[0]);
|
||||
}
|
||||
}
|
||||
// Future<void> togglePlaybackSpeed() async {
|
||||
// List<double> allowedSpeeds =
|
||||
// PlaySpeed.values.map<double>((e) => e.value).toList();
|
||||
// int index = allowedSpeeds.indexOf(_playbackSpeed.value);
|
||||
// if (index < allowedSpeeds.length - 1) {
|
||||
// setPlaybackSpeed(allowedSpeeds[index + 1]);
|
||||
// } else {
|
||||
// setPlaybackSpeed(allowedSpeeds[0]);
|
||||
// }
|
||||
// }
|
||||
|
||||
/// 播放视频
|
||||
Future<void> play({bool repeat = false, bool hideControls = true}) async {
|
||||
|
Reference in New Issue
Block a user