fix:播放异常黑屏等

This commit is contained in:
orz12
2024-03-13 18:38:09 +08:00
parent 766b85cff1
commit cc6da716bc
9 changed files with 50 additions and 35 deletions

View File

@@ -23,8 +23,8 @@ class _EmotePanelState extends State<EmotePanel>
@override
void initState() {
_futureBuilderFuture = _emotePanelController.getEmote();
super.initState();
_futureBuilderFuture = _emotePanelController.getEmote();
}
@override

View File

@@ -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(
() {

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -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();

View File

@@ -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) &&