mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +08:00
opt set shader
opt refresh player Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -34,7 +34,6 @@ import 'package:PiliPlus/utils/accounts.dart';
|
|||||||
import 'package:PiliPlus/utils/asset_utils.dart';
|
import 'package:PiliPlus/utils/asset_utils.dart';
|
||||||
import 'package:PiliPlus/utils/extension/box_ext.dart';
|
import 'package:PiliPlus/utils/extension/box_ext.dart';
|
||||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||||
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
|
||||||
import 'package:PiliPlus/utils/feed_back.dart';
|
import 'package:PiliPlus/utils/feed_back.dart';
|
||||||
import 'package:PiliPlus/utils/image_utils.dart';
|
import 'package:PiliPlus/utils/image_utils.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
@@ -774,10 +773,11 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_videoPlayerController = player;
|
_videoPlayerController = player;
|
||||||
|
if (isAnim && superResolutionType.value != .disable) {
|
||||||
|
await setShader();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAnim) await setShader();
|
|
||||||
|
|
||||||
final Map<String, String> extras = {};
|
final Map<String, String> extras = {};
|
||||||
|
|
||||||
String video = dataSource.videoSource;
|
String video = dataSource.videoSource;
|
||||||
@@ -827,38 +827,17 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> refreshPlayer() async {
|
Future<void>? refreshPlayer() {
|
||||||
if (dataSource is FileSource) {
|
if (dataSource is FileSource) {
|
||||||
return true;
|
return null;
|
||||||
}
|
}
|
||||||
if (_videoPlayerController == null) {
|
if (_videoPlayerController?.current.isNotEmpty ?? false) {
|
||||||
// SmartDialog.showToast('视频播放器为空,请重新进入本页面');
|
return _videoPlayerController!.open(
|
||||||
return false;
|
_videoPlayerController!.current.last.copyWith(start: position),
|
||||||
|
play: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (dataSource.videoSource.isNullOrEmpty) {
|
return null;
|
||||||
SmartDialog.showToast('视频源为空,请重新进入本页面');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Map<String, String> extras = {};
|
|
||||||
String video = dataSource.videoSource;
|
|
||||||
if (dataSource.audioSource case final audio? when (audio.isNotEmpty)) {
|
|
||||||
if (onlyPlayAudio.value) {
|
|
||||||
video = audio;
|
|
||||||
} else {
|
|
||||||
extras['audio-files'] =
|
|
||||||
'"${Platform.isWindows ? audio.replaceAll(';', r'\;') : audio.replaceAll(':', r'\:')}"';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await _videoPlayerController!.open(
|
|
||||||
Media(
|
|
||||||
video,
|
|
||||||
start: position,
|
|
||||||
extras: extras.isEmpty ? null : extras,
|
|
||||||
),
|
|
||||||
play: true,
|
|
||||||
);
|
|
||||||
return true;
|
|
||||||
// seekTo(currentPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开始播放
|
// 开始播放
|
||||||
@@ -999,7 +978,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
'controllerStream.error.listen',
|
'controllerStream.error.listen',
|
||||||
const Duration(milliseconds: 10000),
|
const Duration(milliseconds: 10000),
|
||||||
() {
|
() {
|
||||||
Future.delayed(const Duration(milliseconds: 3000), () async {
|
Future.delayed(const Duration(milliseconds: 3000), () {
|
||||||
// if (kDebugMode) {
|
// if (kDebugMode) {
|
||||||
// debugPrint("isBuffering.value: ${isBuffering.value}");
|
// debugPrint("isBuffering.value: ${isBuffering.value}");
|
||||||
// }
|
// }
|
||||||
@@ -1011,9 +990,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
'视频链接打开失败,重试中',
|
'视频链接打开失败,重试中',
|
||||||
displayTime: const Duration(milliseconds: 500),
|
displayTime: const Duration(milliseconds: 500),
|
||||||
);
|
);
|
||||||
if (!await refreshPlayer()) {
|
refreshPlayer();
|
||||||
if (kDebugMode) debugPrint("failed");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user