mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-30 06:10:10 +08:00
tweak
This commit is contained in:
@@ -19,7 +19,6 @@ import 'package:PiliPlus/models/common/sponsor_block/segment_model.dart';
|
||||
import 'package:PiliPlus/models/common/sponsor_block/segment_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/audio_quality.dart';
|
||||
import 'package:PiliPlus/models/common/video/source_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/subtitle_pref_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_decode_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_quality.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_type.dart';
|
||||
@@ -1050,16 +1049,14 @@ class VideoDetailController extends GetxController
|
||||
|
||||
RxList<Subtitle> subtitles = RxList<Subtitle>();
|
||||
final Map<int, ({bool isData, String id})> vttSubtitles = {};
|
||||
late final RxInt vttSubtitlesIndex = (-1).obs;
|
||||
late final RxBool showVP = true.obs;
|
||||
late final RxList<ViewPointSegment> viewPointList = <ViewPointSegment>[].obs;
|
||||
late final vttSubtitlesIndex = (-1).obs;
|
||||
late final showVP = true.obs;
|
||||
late final viewPointList = <ViewPointSegment>[].obs;
|
||||
|
||||
// 设定字幕轨道
|
||||
Future<void> setSubtitle(int index) async {
|
||||
if (index <= 0) {
|
||||
await plPlayerController.videoPlayerController?.setSubtitleTrack(
|
||||
SubtitleTrack.no(),
|
||||
);
|
||||
await plPlayerController.videoPlayerController?.setSubtitleTrack(.no());
|
||||
vttSubtitlesIndex.value = index;
|
||||
return;
|
||||
}
|
||||
@@ -1136,9 +1133,9 @@ class VideoDetailController extends GetxController
|
||||
);
|
||||
if (res case Success(:final response)) {
|
||||
// interactive video
|
||||
late final introCtr = Get.find<UgcIntroController>(tag: heroTag);
|
||||
if (isUgc && graphVersion == null) {
|
||||
try {
|
||||
final introCtr = Get.find<UgcIntroController>(tag: heroTag);
|
||||
if (introCtr.videoDetail.value.rights?.isSteinGate == 1) {
|
||||
graphVersion = response.interaction?.graphVersion;
|
||||
getSteinEdgeInfo();
|
||||
@@ -1150,22 +1147,18 @@ class VideoDetailController extends GetxController
|
||||
|
||||
if (isUgc && continuePlayingPart) {
|
||||
continuePlayingPart = false;
|
||||
try {
|
||||
UgcIntroController ugcIntroController = Get.find<UgcIntroController>(
|
||||
tag: heroTag,
|
||||
);
|
||||
if ((ugcIntroController.videoDetail.value.pages?.length ?? 0) > 1 &&
|
||||
response.lastPlayCid != null &&
|
||||
response.lastPlayCid != 0) {
|
||||
if (response.lastPlayCid != cid.value) {
|
||||
int index = ugcIntroController.videoDetail.value.pages!
|
||||
.indexWhere((item) => item.cid == response.lastPlayCid);
|
||||
final lastCid = response.lastPlayCid;
|
||||
if (lastCid != null && lastCid != 0 && lastCid != cid.value) {
|
||||
try {
|
||||
final pages = introCtr.videoDetail.value.pages;
|
||||
if (pages != null && pages.length > 1) {
|
||||
final index = pages.indexWhere((item) => item.cid == lastCid);
|
||||
if (index != -1) {
|
||||
onAddItem(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (plPlayerController.showViewPoints &&
|
||||
@@ -1184,16 +1177,14 @@ class VideoDetailController extends GetxController
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
if (response.subtitle?.subtitles?.isNotEmpty == true) {
|
||||
subtitles.value = response.subtitle!.subtitles!;
|
||||
|
||||
if (response.subtitle?.subtitles case final sub? when (sub.isNotEmpty)) {
|
||||
subtitles.value = sub;
|
||||
final idx = switch (Pref.subtitlePreferenceV2) {
|
||||
SubtitlePrefType.off => 0,
|
||||
SubtitlePrefType.on => 1,
|
||||
SubtitlePrefType.withoutAi =>
|
||||
subtitles.first.lan.startsWith('ai') ? 0 : 1,
|
||||
SubtitlePrefType.auto =>
|
||||
!subtitles.first.lan.startsWith('ai') ||
|
||||
.off => 0,
|
||||
.on => 1,
|
||||
.withoutAi => sub.first.lan.startsWith('ai') ? 0 : 1,
|
||||
.auto =>
|
||||
!sub.first.lan.startsWith('ai') ||
|
||||
(PlatformUtils.isMobile &&
|
||||
(await FlutterVolumeController.getVolume() ?? 0.0) <=
|
||||
0.0)
|
||||
|
||||
@@ -110,7 +110,7 @@ class _ViewPointsPageState extends State<ViewPointsPage>
|
||||
}
|
||||
}
|
||||
final isCurr = currentIndex == index;
|
||||
return _buildItem(theme, segment, isCurr);
|
||||
return _buildItem(theme.colorScheme, segment, isCurr);
|
||||
},
|
||||
);
|
||||
if (_isNested) {
|
||||
@@ -122,8 +122,11 @@ class _ViewPointsPageState extends State<ViewPointsPage>
|
||||
return child;
|
||||
}
|
||||
|
||||
Widget _buildItem(ThemeData theme, ViewPointSegment segment, bool isCurr) {
|
||||
final theme = Theme.of(context);
|
||||
Widget _buildItem(
|
||||
ColorScheme colorScheme,
|
||||
ViewPointSegment segment,
|
||||
bool isCurr,
|
||||
) {
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
@@ -137,18 +140,11 @@ class _ViewPointsPageState extends State<ViewPointsPage>
|
||||
}
|
||||
: null,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: Style.safeSpace,
|
||||
vertical: 5,
|
||||
),
|
||||
padding: const .symmetric(horizontal: Style.safeSpace, vertical: 5),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
src: segment.url,
|
||||
width: 140.8,
|
||||
height: 88,
|
||||
),
|
||||
NetworkImgLayer(src: segment.url, width: 140.8, height: 88),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -163,14 +159,14 @@ class _ViewPointsPageState extends State<ViewPointsPage>
|
||||
style: isCurr
|
||||
? TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.colorScheme.primary,
|
||||
color: colorScheme.primary,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
Text(
|
||||
'${segment.from != null ? DurationUtils.formatDuration(segment.from) : ''} - '
|
||||
'${segment.to != null ? DurationUtils.formatDuration(segment.to) : ''}',
|
||||
style: TextStyle(color: theme.colorScheme.outline),
|
||||
style: TextStyle(color: colorScheme.outline),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user