fix: 视频跳转画面停留、视频继续进度播放
This commit is contained in:
@ -230,8 +230,6 @@ class PlPlayerController {
|
|||||||
try {
|
try {
|
||||||
_autoPlay = autoplay;
|
_autoPlay = autoplay;
|
||||||
_looping = looping;
|
_looping = looping;
|
||||||
// 初始化视频时长
|
|
||||||
_duration.value = duration ?? Duration.zero;
|
|
||||||
// 初始化视频倍速
|
// 初始化视频倍速
|
||||||
_playbackSpeed.value = speed;
|
_playbackSpeed.value = speed;
|
||||||
// 初始化数据加载状态
|
// 初始化数据加载状态
|
||||||
@ -248,7 +246,7 @@ class PlPlayerController {
|
|||||||
_videoPlayerController = await _createVideoController(
|
_videoPlayerController = await _createVideoController(
|
||||||
dataSource, _looping, enableHA, width, height);
|
dataSource, _looping, enableHA, width, height);
|
||||||
// 获取视频时长 00:00
|
// 获取视频时长 00:00
|
||||||
_duration.value = _videoPlayerController!.state.duration;
|
_duration.value = duration ?? _videoPlayerController!.state.duration;
|
||||||
// 数据加载完成
|
// 数据加载完成
|
||||||
dataStatus.status.value = DataStatus.loaded;
|
dataStatus.status.value = DataStatus.loaded;
|
||||||
|
|
||||||
@ -274,7 +272,8 @@ class PlPlayerController {
|
|||||||
) async {
|
) async {
|
||||||
// 每次配置时先移除监听
|
// 每次配置时先移除监听
|
||||||
removeListeners();
|
removeListeners();
|
||||||
|
isBuffering.value = false;
|
||||||
|
buffered.value = Duration.zero;
|
||||||
Player player = _videoPlayerController ??
|
Player player = _videoPlayerController ??
|
||||||
Player(
|
Player(
|
||||||
configuration: const PlayerConfiguration(
|
configuration: const PlayerConfiguration(
|
||||||
@ -430,7 +429,7 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
_position.value = position;
|
_position.value = position;
|
||||||
if (duration.value.inSeconds != 0) {
|
if (duration.value.inSeconds != 0) {
|
||||||
// await _videoPlayerController!.stream.buffer.first;
|
await _videoPlayerController!.stream.buffer.first;
|
||||||
await _videoPlayerController?.seek(position);
|
await _videoPlayerController?.seek(position);
|
||||||
// if (playerStatus.stopped) {
|
// if (playerStatus.stopped) {
|
||||||
// play();
|
// play();
|
||||||
|
@ -648,6 +648,23 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
Obx(() {
|
||||||
|
if (_.buffered.value == Duration.zero) {
|
||||||
|
return Positioned.fill(
|
||||||
|
child: Container(
|
||||||
|
color: Colors.black,
|
||||||
|
child: Center(
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/loading.gif',
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
/// 点击 快进/快退
|
/// 点击 快进/快退
|
||||||
if (_mountSeekBackwardButton || _mountSeekForwardButton)
|
if (_mountSeekBackwardButton || _mountSeekForwardButton)
|
||||||
|
Reference in New Issue
Block a user