mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-26 04:10:14 +08:00
committed by
GitHub
parent
1c19925b58
commit
199ad274b7
@@ -36,6 +36,7 @@ import 'package:PiliPlus/utils/android/android_helper.dart';
|
||||
import 'package:PiliPlus/utils/android/bindings.g.dart';
|
||||
import 'package:PiliPlus/utils/asset_utils.dart';
|
||||
import 'package:PiliPlus/utils/device_utils.dart';
|
||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||
import 'package:PiliPlus/utils/extension/box_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
@@ -46,7 +47,6 @@ import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/theme_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:archive/archive.dart' show getCrc32;
|
||||
import 'package:canvas_danmaku/canvas_danmaku.dart';
|
||||
@@ -772,16 +772,12 @@ class PlPlayerController with BlockConfigMixin {
|
||||
assert(_videoPlayerController == null);
|
||||
final opt = {
|
||||
'video-sync': Pref.videoSync,
|
||||
if (Platform.isAndroid) 'ao': Pref.audioOutput,
|
||||
'volume':
|
||||
(PlatformUtils.isMobile ? Pref.playerVolume : volume.value * 100)
|
||||
.toString(),
|
||||
'volume-max': kMaxVolume.toString(),
|
||||
};
|
||||
if (Platform.isAndroid) {
|
||||
opt['ao'] = Pref.audioOutput;
|
||||
}
|
||||
if (PlatformUtils.isMobile) {
|
||||
opt['volume'] = Pref.playerVolume.toString();
|
||||
} else {
|
||||
opt['volume'] = (volume.value * 100).toString();
|
||||
}
|
||||
opt['volume-max'] = kMaxVolume.toString();
|
||||
final autosync = Pref.autosync;
|
||||
if (autosync != '0') {
|
||||
opt['autosync'] = autosync;
|
||||
@@ -1737,6 +1733,9 @@ class PlPlayerController with BlockConfigMixin {
|
||||
|
||||
Future<void> takeScreenshot() async {
|
||||
SmartDialog.showToast('截图中');
|
||||
final time = DurationUtils.formatDuration(
|
||||
position.inMilliseconds / 1000,
|
||||
).replaceAll(':', '-');
|
||||
final image = await videoPlayerController?.screenshot();
|
||||
if (image != null) {
|
||||
SmartDialog.showToast('点击弹窗保存截图');
|
||||
@@ -1748,7 +1747,7 @@ class PlPlayerController with BlockConfigMixin {
|
||||
if (bytes != null) {
|
||||
ImageUtils.saveByteImg(
|
||||
bytes: bytes.buffer.asUint8List(),
|
||||
fileName: 'screenshot_${ImageUtils.time}',
|
||||
fileName: 'screenshot_${cid}_$time',
|
||||
);
|
||||
}
|
||||
Get.back();
|
||||
@@ -1765,7 +1764,7 @@ class PlPlayerController with BlockConfigMixin {
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 5,
|
||||
color: ThemeUtils.theme.colorScheme.surface,
|
||||
color: ColorScheme.of(context).surface,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
|
||||
@@ -25,8 +25,6 @@ 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';
|
||||
import 'package:PiliPlus/pages/common/common_intro_controller.dart';
|
||||
import 'package:PiliPlus/pages/danmaku/danmaku_model.dart';
|
||||
@@ -579,9 +577,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
String bvid = plPlayerController.bvid;
|
||||
List<ugc.BaseEpisodeItem> episodes = [];
|
||||
if (isSeason) {
|
||||
final List<SectionItem> sections = videoDetail.ugcSeason!.sections!;
|
||||
final sections = videoDetail.ugcSeason!.sections!;
|
||||
for (int i = 0; i < sections.length; i++) {
|
||||
final List<EpisodeItem> episodesList = sections[i].episodes!;
|
||||
final episodesList = sections[i].episodes!;
|
||||
for (final item in episodesList) {
|
||||
if (item.cid == currentCid) {
|
||||
index = i;
|
||||
@@ -811,18 +809,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
if (videoInfo.dash == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final List<FormatItem> videoFormat = videoInfo.supportFormats!;
|
||||
final int totalQaSam = videoFormat.length;
|
||||
int usefulQaSam = 0;
|
||||
final List<VideoItem> video = videoInfo.dash!.video!;
|
||||
final Set<int> idSet = {};
|
||||
for (final VideoItem item in video) {
|
||||
final int id = item.id!;
|
||||
if (!idSet.contains(id)) {
|
||||
idSet.add(id);
|
||||
usefulQaSam++;
|
||||
}
|
||||
}
|
||||
final videoFormat = videoInfo.supportFormats!;
|
||||
final totalQaSam = videoFormat.length;
|
||||
final usefulQaSam = videoInfo.dash!.video!
|
||||
.map((i) => i.id)
|
||||
.toSet()
|
||||
.length;
|
||||
return PopupMenuButton<int>(
|
||||
tooltip: '画质',
|
||||
requestFocus: false,
|
||||
@@ -892,16 +884,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
height: 30,
|
||||
tooltip: isFullScreen ? '退出全屏' : '全屏',
|
||||
icon: isFullScreen
|
||||
? const Icon(
|
||||
Icons.fullscreen_exit,
|
||||
size: 24,
|
||||
color: Colors.white,
|
||||
)
|
||||
: const Icon(
|
||||
Icons.fullscreen,
|
||||
size: 24,
|
||||
color: Colors.white,
|
||||
),
|
||||
? const Icon(Icons.fullscreen_exit, size: 24, color: Colors.white)
|
||||
: const Icon(Icons.fullscreen, size: 24, color: Colors.white),
|
||||
onTap: () =>
|
||||
plPlayerController.triggerFullScreen(status: !isFullScreen),
|
||||
onSecondaryTap: () => plPlayerController.triggerFullScreen(
|
||||
@@ -914,29 +898,24 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
final isNotFileSource = !plPlayerController.isFileSource;
|
||||
|
||||
List<BottomControlType> userSpecifyItemLeft = [
|
||||
BottomControlType.playOrPause,
|
||||
BottomControlType.time,
|
||||
if (!isNotFileSource || anySeason) ...[
|
||||
BottomControlType.pre,
|
||||
BottomControlType.next,
|
||||
],
|
||||
.playOrPause,
|
||||
.time,
|
||||
if (!isNotFileSource || anySeason) ...[.pre, .next],
|
||||
];
|
||||
|
||||
final flag =
|
||||
isFullScreen || plPlayerController.isDesktopPip || maxWidth >= 500;
|
||||
List<BottomControlType> userSpecifyItemRight = [
|
||||
if (isNotFileSource && plPlayerController.showDmChart)
|
||||
BottomControlType.dmChart,
|
||||
if (plPlayerController.isAnim) BottomControlType.superResolution,
|
||||
if (isNotFileSource && plPlayerController.showViewPoints)
|
||||
BottomControlType.viewPoints,
|
||||
if (isNotFileSource && anySeason) BottomControlType.episode,
|
||||
if (flag) BottomControlType.fit,
|
||||
if (isNotFileSource) BottomControlType.aiTranslate,
|
||||
BottomControlType.subtitle,
|
||||
BottomControlType.speed,
|
||||
if (isNotFileSource && flag) BottomControlType.qa,
|
||||
if (!plPlayerController.isDesktopPip) BottomControlType.fullscreen,
|
||||
final List<BottomControlType> userSpecifyItemRight = [
|
||||
if (isNotFileSource && plPlayerController.showDmChart) .dmChart,
|
||||
if (plPlayerController.isAnim) .superResolution,
|
||||
if (isNotFileSource && plPlayerController.showViewPoints) .viewPoints,
|
||||
if (isNotFileSource && anySeason) .episode,
|
||||
if (flag) .fit,
|
||||
if (isNotFileSource) .aiTranslate,
|
||||
.subtitle,
|
||||
.speed,
|
||||
if (isNotFileSource && flag) .qa,
|
||||
if (!plPlayerController.isDesktopPip) .fullscreen,
|
||||
];
|
||||
return PlayerBar(
|
||||
children: [
|
||||
@@ -1058,21 +1037,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
displayTime: const Duration(milliseconds: 1500),
|
||||
maskColor: Colors.transparent,
|
||||
builder: (context) => Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
),
|
||||
padding: const .symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(6),
|
||||
),
|
||||
borderRadius: const .all(.circular(6)),
|
||||
color: colorScheme.secondaryContainer,
|
||||
),
|
||||
child: Text(
|
||||
'松开手指,取消进退',
|
||||
style: TextStyle(
|
||||
color: colorScheme.onSecondaryContainer,
|
||||
),
|
||||
style: TextStyle(color: colorScheme.onSecondaryContainer),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user