mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-19 17:00:13 +08:00
fix:播放异常黑屏等
This commit is contained in:
@@ -123,7 +123,9 @@ class MyApp extends StatelessWidget {
|
||||
DisplayMode preferred = modes.toList().firstWhere((el) => el == f);
|
||||
FlutterDisplayMode.setPreferredMode(preferred);
|
||||
});
|
||||
} catch (_) {}
|
||||
} catch (e) {
|
||||
SmartDialog.showToast('设置帧率失败:$e', displayTime: const Duration(milliseconds: 500));
|
||||
}
|
||||
}
|
||||
|
||||
return DynamicColorBuilder(
|
||||
|
||||
@@ -23,8 +23,8 @@ class _EmotePanelState extends State<EmotePanel>
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_futureBuilderFuture = _emotePanelController.getEmote();
|
||||
super.initState();
|
||||
_futureBuilderFuture = _emotePanelController.getEmote();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -24,8 +24,8 @@ class _HistoryPageState extends State<HistoryPage> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_futureBuilderFuture = _historyController.queryHistoryList();
|
||||
super.initState();
|
||||
_futureBuilderFuture = _historyController.queryHistoryList();
|
||||
scrollController = _historyController.scrollController;
|
||||
scrollController.addListener(
|
||||
() {
|
||||
|
||||
@@ -94,7 +94,8 @@ class _RcmdPageState extends State<RcmdPage>
|
||||
sliver: FutureBuilder(
|
||||
future: _futureBuilderFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.connectionState == ConnectionState.done &&
|
||||
snapshot.data != null) {
|
||||
Map data = snapshot.data as Map;
|
||||
if (data['status']) {
|
||||
return Obx(
|
||||
@@ -111,7 +112,7 @@ class _RcmdPageState extends State<RcmdPage>
|
||||
);
|
||||
} else {
|
||||
return HttpError(
|
||||
errMsg: data['msg'],
|
||||
errMsg: data == null ? "" : data['msg'],
|
||||
fn: () {
|
||||
setState(() {
|
||||
_rcmdController.isLoadingMore = true;
|
||||
|
||||
@@ -268,7 +268,9 @@ class VideoDetailController extends GetxController
|
||||
// 硬解
|
||||
enableHA: enableHA.value,
|
||||
seekTo: seekToTime ?? defaultST,
|
||||
duration: duration ?? Duration(milliseconds: data.timeLength ?? 0),
|
||||
duration: duration ?? data.timeLength == null
|
||||
? null
|
||||
: Duration(milliseconds: data.timeLength!),
|
||||
// 宽>高 水平 否则 垂直
|
||||
direction: firstVideo.width != null && firstVideo.height != null
|
||||
? ((firstVideo.width! - firstVideo.height!) > 0
|
||||
|
||||
@@ -39,11 +39,11 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_videoReplyReplyController = Get.put(
|
||||
VideoReplyReplyController(
|
||||
widget.oid, widget.rpid.toString(), widget.replyType!),
|
||||
tag: widget.rpid.toString());
|
||||
super.initState();
|
||||
|
||||
// 上拉加载更多
|
||||
scrollController = _videoReplyReplyController.scrollController;
|
||||
|
||||
@@ -293,10 +293,20 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
!videoDetailController.isShowCover.value;
|
||||
videoIntroController.isPaused = false;
|
||||
if (autoplay) {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
plPlayerController?.seekTo(videoDetailController.defaultST);
|
||||
plPlayerController?.play();
|
||||
// await Future.delayed(const Duration(milliseconds: 300));
|
||||
if (plPlayerController?.buffered.value == Duration.zero) {
|
||||
plPlayerController?.buffered.listen((p0) {
|
||||
if (p0 > Duration.zero) {
|
||||
plPlayerController?.seekTo(videoDetailController.defaultST);
|
||||
plPlayerController?.play();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
plPlayerController?.seekTo(videoDetailController.defaultST);
|
||||
plPlayerController?.play();
|
||||
}
|
||||
}
|
||||
AutoOrientation.fullAutoMode();
|
||||
plPlayerController?.addStatusLister(playerListener);
|
||||
if (plPlayerController != null) {
|
||||
listenFullScreenStatus();
|
||||
|
||||
@@ -1063,19 +1063,16 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
size: 15,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () => <Set<void>>{
|
||||
if (widget.controller!.isFullScreen.value)
|
||||
<void>{widget.controller!.triggerFullScreen(status: false)}
|
||||
else
|
||||
<void>{
|
||||
if (MediaQuery.of(context).orientation ==
|
||||
Orientation.landscape &&
|
||||
!horizontalScreen)
|
||||
{
|
||||
verticalScreenForTwoSeconds(),
|
||||
},
|
||||
Get.back()
|
||||
}
|
||||
onPressed: () {
|
||||
if (widget.controller!.isFullScreen.value) {
|
||||
widget.controller!.triggerFullScreen(status: false);
|
||||
} else if (MediaQuery.of(context).orientation ==
|
||||
Orientation.landscape &&
|
||||
!horizontalScreen) {
|
||||
verticalScreenForTwoSeconds();
|
||||
} else {
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
)),
|
||||
if ((videoIntroController.videoDetail.value.title != null) &&
|
||||
|
||||
@@ -83,8 +83,8 @@ class PlPlayerController {
|
||||
|
||||
final Rx<BoxFit> _videoFit = Rx(videoFitType.first['attr']);
|
||||
final Rx<String> _videoFitDesc = Rx(videoFitType.first['desc']);
|
||||
late StreamSubscription<Duration> _bufferedListenerForVideoFit;
|
||||
late StreamSubscription<Duration> _bufferedListenerForEnterFullscreen;
|
||||
late StreamSubscription<DataStatus> _dataListenerForVideoFit;
|
||||
late StreamSubscription<DataStatus> _dataListenerForEnterFullscreen;
|
||||
|
||||
///
|
||||
// ignore: prefer_final_fields
|
||||
@@ -233,7 +233,6 @@ class PlPlayerController {
|
||||
late double strokeWidth;
|
||||
late double danmakuDurationVal;
|
||||
late List<double> speedsList;
|
||||
// 缓存
|
||||
double? defaultDuration;
|
||||
late bool enableAutoLongPressSpeed = false;
|
||||
|
||||
@@ -555,10 +554,10 @@ class PlPlayerController {
|
||||
bool autoEnterFullscreen = GStrorage.setting
|
||||
.get(SettingBoxKey.enableAutoEnter, defaultValue: false);
|
||||
if (autoEnterFullscreen) {
|
||||
if (buffered.value == Duration.zero) {
|
||||
_bufferedListenerForEnterFullscreen = buffered.listen((status) {
|
||||
if (status > Duration.zero) {
|
||||
_bufferedListenerForEnterFullscreen.cancel();
|
||||
if (dataStatus.status.value != DataStatus.loaded) {
|
||||
_dataListenerForEnterFullscreen = dataStatus.status.listen((status) {
|
||||
if (status == DataStatus.loaded) {
|
||||
_dataListenerForEnterFullscreen.cancel();
|
||||
triggerFullScreen(status: true);
|
||||
}
|
||||
});
|
||||
@@ -930,9 +929,9 @@ class PlPlayerController {
|
||||
if (attr == BoxFit.none || attr == BoxFit.scaleDown) {
|
||||
if (buffered.value == Duration.zero) {
|
||||
attr = BoxFit.contain;
|
||||
_bufferedListenerForVideoFit = buffered.listen((status) {
|
||||
if (status > Duration.zero) {
|
||||
_bufferedListenerForVideoFit.cancel();
|
||||
_dataListenerForVideoFit = dataStatus.status.listen((status) {
|
||||
if (status == DataStatus.loaded) {
|
||||
_dataListenerForVideoFit.cancel();
|
||||
int fitValue =
|
||||
videoStorage.get(VideoBoxKey.cacheVideoFit, defaultValue: 0);
|
||||
var attr = videoFitType[fitValue]['attr'];
|
||||
@@ -1023,9 +1022,13 @@ class PlPlayerController {
|
||||
// StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
||||
showStatusBar();
|
||||
toggleFullScreen(false);
|
||||
if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false) &&
|
||||
mode != FullScreenMode.none) {
|
||||
if (mode == FullScreenMode.none) {
|
||||
return;
|
||||
}
|
||||
if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
||||
await verticalScreenForTwoSeconds();
|
||||
} else {
|
||||
await autoScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user