mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-20 09:20:13 +08:00
@@ -27,6 +27,7 @@ import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||
import 'package:PiliPlus/services/service_locator.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/android/bindings.g.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/image_utils.dart';
|
||||
@@ -35,7 +36,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:archive/archive.dart' show getCrc32;
|
||||
import 'package:canvas_danmaku/canvas_danmaku.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
@@ -584,16 +584,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 player = await Player.create(
|
||||
configuration: PlayerConfiguration(
|
||||
@@ -1388,6 +1384,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('点击弹窗保存截图');
|
||||
@@ -1400,7 +1399,7 @@ class PlPlayerController with BlockConfigMixin {
|
||||
if (bytes != null) {
|
||||
ImageUtils.saveByteImg(
|
||||
bytes: bytes.buffer.asUint8List(),
|
||||
fileName: 'screenshot_${ImageUtils.time}',
|
||||
fileName: 'screenshot_${cid}_$time',
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -1416,7 +1415,7 @@ class PlPlayerController with BlockConfigMixin {
|
||||
decoration: BoxDecoration(
|
||||
border: .all(
|
||||
width: 5,
|
||||
color: ThemeUtils.theme.colorScheme.surface,
|
||||
color: ColorScheme.of(context).surface,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
|
||||
@@ -19,8 +19,6 @@ import 'package:PiliPlus/common/widgets/view_safe_area.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/video/controller.dart';
|
||||
@@ -452,9 +450,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;
|
||||
@@ -681,18 +679,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,
|
||||
@@ -760,16 +752,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(
|
||||
|
||||
Reference in New Issue
Block a user