mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-22 03:31:09 +08:00
feat: video download
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -19,6 +19,7 @@ import 'package:PiliPlus/models/common/sponsor_block/segment_type.dart';
|
||||
import 'package:PiliPlus/models/common/super_resolution_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_quality.dart';
|
||||
import 'package:PiliPlus/models/video/play/url.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart' as ugc;
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/section.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/ugc_season.dart';
|
||||
@@ -51,6 +52,7 @@ import 'package:PiliPlus/utils/duration_utils.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/path_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -98,7 +100,14 @@ class PLVideoPlayer extends StatefulWidget {
|
||||
final Widget headerControl;
|
||||
final Widget? bottomControl;
|
||||
final Widget? danmuWidget;
|
||||
final void Function([int?, UgcSeason?, dynamic, String?, int?, int?])?
|
||||
final void Function([
|
||||
int?,
|
||||
UgcSeason?,
|
||||
List<ugc.BaseEpisodeItem>?,
|
||||
String?,
|
||||
int?,
|
||||
int?,
|
||||
])?
|
||||
showEpisodes;
|
||||
final VoidCallback? showViewPoints;
|
||||
final Color fill;
|
||||
@@ -517,6 +526,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
if (videoDetailController.isFileSource) {
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
// part -> playAll -> season(pgc)
|
||||
if (isPlayAll && !isPart) {
|
||||
widget.showEpisodes?.call();
|
||||
@@ -525,7 +538,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
int? index;
|
||||
int currentCid = plPlayerController.cid!;
|
||||
String bvid = plPlayerController.bvid;
|
||||
List episodes = [];
|
||||
List<ugc.BaseEpisodeItem> episodes = [];
|
||||
if (isSeason) {
|
||||
final List<SectionItem> sections = videoDetail.ugcSeason!.sections!;
|
||||
for (int i = 0; i < sections.length; i++) {
|
||||
@@ -836,10 +849,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
),
|
||||
};
|
||||
|
||||
final isNotFileSource = !plPlayerController.isFileSource;
|
||||
|
||||
List<BottomControlType> userSpecifyItemLeft = [
|
||||
BottomControlType.playOrPause,
|
||||
BottomControlType.time,
|
||||
if (anySeason) ...[
|
||||
if (!isNotFileSource || anySeason) ...[
|
||||
BottomControlType.pre,
|
||||
BottomControlType.next,
|
||||
],
|
||||
@@ -848,15 +863,19 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
final flag =
|
||||
isFullScreen || plPlayerController.isDesktopPip || maxWidth >= 500;
|
||||
List<BottomControlType> userSpecifyItemRight = [
|
||||
if (plPlayerController.showDmChart) BottomControlType.dmChart,
|
||||
if (isNotFileSource && plPlayerController.showDmChart)
|
||||
BottomControlType.dmChart,
|
||||
if (plPlayerController.isAnim) BottomControlType.superResolution,
|
||||
if (plPlayerController.showViewPoints) BottomControlType.viewPoints,
|
||||
if (anySeason) BottomControlType.episode,
|
||||
if (isNotFileSource && plPlayerController.showViewPoints)
|
||||
BottomControlType.viewPoints,
|
||||
if (isNotFileSource || anySeason) BottomControlType.episode,
|
||||
if (flag) BottomControlType.fit,
|
||||
BottomControlType.aiTranslate,
|
||||
BottomControlType.subtitle,
|
||||
if (isNotFileSource) ...[
|
||||
BottomControlType.aiTranslate,
|
||||
BottomControlType.subtitle,
|
||||
],
|
||||
BottomControlType.speed,
|
||||
if (flag) BottomControlType.qa,
|
||||
if (isNotFileSource && flag) BottomControlType.qa,
|
||||
if (!plPlayerController.isDesktopPip) BottomControlType.fullscreen,
|
||||
];
|
||||
|
||||
@@ -1034,7 +1053,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
plPlayerController
|
||||
..onUpdatedSliderProgress(result)
|
||||
..onChangedSliderStart();
|
||||
if (plPlayerController.showSeekPreview &&
|
||||
if (!plPlayerController.isFileSource &&
|
||||
plPlayerController.showSeekPreview &&
|
||||
plPlayerController.cancelSeek != true) {
|
||||
plPlayerController.updatePreviewIndex(newPos ~/ 1000);
|
||||
}
|
||||
@@ -1285,7 +1305,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
plPlayerController
|
||||
..onUpdatedSliderProgress(result)
|
||||
..onChangedSliderStart();
|
||||
if (plPlayerController.showSeekPreview &&
|
||||
if (!plPlayerController.isFileSource &&
|
||||
plPlayerController.showSeekPreview &&
|
||||
plPlayerController.cancelSeek != true) {
|
||||
plPlayerController.updatePreviewIndex(newPos ~/ 1000);
|
||||
}
|
||||
@@ -2186,7 +2207,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
final progress = 0.0.obs;
|
||||
final name =
|
||||
'${ctr.cid}-${segment.first.toStringAsFixed(3)}_${segment.second.toStringAsFixed(3)}.webp';
|
||||
final file = '${await Utils.temporaryDirectory}/$name';
|
||||
final file = '$tmpDirPath/$name';
|
||||
|
||||
final mpv = MpvConvertWebp(
|
||||
url!,
|
||||
|
||||
Reference in New Issue
Block a user