提交 837b09c7 authored 作者: kongdywang's avatar kongdywang

fix player widget play status error when switch stream

上级 ae47a1ce
......@@ -3,7 +3,6 @@ part of demo_super_player_lib;
enum SuperPlayerState {
INIT, // Initial state
PREPARED, // prepared
PLAYING, // Playing
PAUSE, // Paused
LOADING, // Buffering
......
......@@ -134,7 +134,6 @@ class SuperPlayerController {
}
videoDuration = await _vodPlayerController.getDuration();
currentDuration = await _vodPlayerController.getCurrentPlaybackTime();
_updatePlayerState(SuperPlayerState.PREPARED);
break;
case TXVodPlayEvent.PLAY_EVT_PLAY_LOADING: // PLAY_EVT_PLAY_LOADING
if (playerState == SuperPlayerState.PAUSE) {
......@@ -571,8 +570,6 @@ class SuperPlayerController {
playerState = state;
switch (state) {
case SuperPlayerState.INIT:
break;
case SuperPlayerState.PREPARED:
_observer?.onPlayPrepare();
break;
case SuperPlayerState.PLAYING:
......
......@@ -22,7 +22,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
late SuperPlayerController _playController;
bool _isFloatingMode = false;
bool _isPlaying = false;
bool _isLoading = false;
bool _isLoading = true;
bool _isShowCover = true;
double _radioWidth = 0;
......@@ -269,13 +269,9 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
_isLoading = true;
_coverViewKey.currentState?.hideCover();
break;
case SuperPlayerState.PREPARED:
_isPlaying = false;
_isLoading = false;
break;
case SuperPlayerState.INIT:
_isPlaying = false;
_isLoading = true;
_isLoading = false;
break;
}
}
......@@ -604,7 +600,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
int playAction = _playController.videoModel!.playAction;
if (playerState == SuperPlayerState.LOADING && playAction == SuperPlayerModel.PLAY_ACTION_PRELOAD) {
_playController.resume();
} else if (playerState == SuperPlayerState.INIT || playerState == SuperPlayerState.PREPARED) {
} else if (playerState == SuperPlayerState.INIT) {
if (playAction == SuperPlayerModel.PLAY_ACTION_PRELOAD) {
_playController.resume();
} else if (playAction == SuperPlayerModel.PLAY_ACTION_MANUAL_PLAY) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论