mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: partial revert
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1113,19 +1113,6 @@ class VideoDetailController extends GetxController
|
||||
return;
|
||||
}
|
||||
isQuerying = true;
|
||||
await Future.wait([
|
||||
if (enableSponsorBlock) _querySponsorBlock(),
|
||||
_actualQuery(),
|
||||
]);
|
||||
if (autoPlay.value && videoUrl != null && audioUrl != null) {
|
||||
isShowCover.value = false;
|
||||
await playerInit();
|
||||
videoState.value = LoadingState.success(null);
|
||||
}
|
||||
isQuerying = false;
|
||||
}
|
||||
|
||||
Future _actualQuery() async {
|
||||
if (cacheVideoQa == null) {
|
||||
await Connectivity().checkConnectivity().then((res) {
|
||||
cacheVideoQa = res.contains(ConnectivityResult.wifi)
|
||||
@@ -1150,14 +1137,16 @@ class VideoDetailController extends GetxController
|
||||
if (result['status']) {
|
||||
data = result['data'];
|
||||
|
||||
if (enableSponsorBlock) {
|
||||
await _querySponsorBlock();
|
||||
}
|
||||
|
||||
if (data.acceptDesc!.isNotEmpty && data.acceptDesc!.contains('试看')) {
|
||||
SmartDialog.showToast(
|
||||
'该视频为专属视频,仅提供试看',
|
||||
displayTime: const Duration(seconds: 3),
|
||||
);
|
||||
}
|
||||
|
||||
/// #1
|
||||
if (data.dash == null && data.durl != null) {
|
||||
videoUrl = data.durl!.first.url!;
|
||||
audioUrl = '';
|
||||
@@ -1170,28 +1159,22 @@ class VideoDetailController extends GetxController
|
||||
quality: VideoQualityCode.fromCode(data.quality!)!);
|
||||
currentDecodeFormats = VideoDecodeFormatsCode.fromString('avc1')!;
|
||||
currentVideoQa = VideoQualityCode.fromCode(data.quality!)!;
|
||||
|
||||
/// await sponsorblock
|
||||
// if (autoPlay.value) {
|
||||
// isShowCover.value = false;
|
||||
// await playerInit();
|
||||
// }
|
||||
if (autoPlay.value.not) {
|
||||
if (autoPlay.value) {
|
||||
isShowCover.value = false;
|
||||
await playerInit();
|
||||
videoState.value = LoadingState.success(null);
|
||||
}
|
||||
isQuerying = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/// #2
|
||||
if (data.dash == null) {
|
||||
SmartDialog.showToast('视频资源不存在');
|
||||
autoPlay.value = false;
|
||||
isShowCover.value = true;
|
||||
videoState.value = LoadingState.error('视频资源不存在');
|
||||
isQuerying = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/// #3
|
||||
final List<VideoItem> allVideosList = data.dash!.video!;
|
||||
// debugPrint("allVideosList:${allVideosList}");
|
||||
// 当前可播放的最高质量视频
|
||||
@@ -1285,13 +1268,9 @@ class VideoDetailController extends GetxController
|
||||
}
|
||||
//
|
||||
defaultST = Duration(milliseconds: data.lastPlayTime!);
|
||||
|
||||
/// await sponsorblock
|
||||
// if (autoPlay.value) {
|
||||
// isShowCover.value = false;
|
||||
// await playerInit();
|
||||
// }
|
||||
if (autoPlay.value.not) {
|
||||
if (autoPlay.value) {
|
||||
isShowCover.value = false;
|
||||
await playerInit();
|
||||
videoState.value = LoadingState.success(null);
|
||||
}
|
||||
} else {
|
||||
@@ -1307,6 +1286,7 @@ class VideoDetailController extends GetxController
|
||||
SmartDialog.showToast("错误(${result['code']}):${result['msg']}");
|
||||
}
|
||||
}
|
||||
isQuerying = false;
|
||||
}
|
||||
|
||||
List<PostSegmentModel>? list;
|
||||
|
||||
@@ -294,10 +294,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
plPlayerController = videoDetailController.plPlayerController;
|
||||
videoDetailController.isShowCover.value = false;
|
||||
await videoDetailController.playerInit(autoplay: true);
|
||||
videoDetailController.autoPlay.value = true;
|
||||
videoDetailController.videoState.value = LoadingState.success(null);
|
||||
plPlayerController!.addStatusLister(playerListener);
|
||||
plPlayerController!.addPositionListener(positionListener);
|
||||
await plPlayerController!.autoEnterFullscreen();
|
||||
videoDetailController.autoPlay.value = true;
|
||||
}
|
||||
|
||||
// // 生命周期监听
|
||||
@@ -1071,8 +1072,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
() => videoDetailController.videoState.value is! Success
|
||||
? const SizedBox.shrink()
|
||||
: !videoDetailController.autoPlay.value ||
|
||||
plPlayerController == null ||
|
||||
plPlayerController!.videoController == null
|
||||
plPlayerController?.videoController == null
|
||||
? const SizedBox.shrink()
|
||||
: PLVideoPlayer(
|
||||
plPlayerController: plPlayerController!,
|
||||
|
||||
@@ -500,9 +500,11 @@ class PlPlayerController {
|
||||
dataSource, _looping, enableHA, hwdec, width, height);
|
||||
// 获取视频时长 00:00
|
||||
_duration.value = duration ?? _videoPlayerController!.state.duration;
|
||||
_position.value = _sliderPosition.value = seekTo ?? Duration.zero;
|
||||
_position.value =
|
||||
_sliderPosition.value = _buffered.value = seekTo ?? Duration.zero;
|
||||
updateDurationSecond();
|
||||
updatePositionSecond();
|
||||
updateBufferedSecond();
|
||||
updateSliderPositionSecond();
|
||||
// 数据加载完成
|
||||
dataStatus.status.value = DataStatus.loaded;
|
||||
|
||||
Reference in New Issue
Block a user