mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-24 16:04:43 +01:00
Fix video ignored seeking after finished
This commit is contained in:
parent
6927f94d54
commit
a0382d2b16
1 changed files with 8 additions and 9 deletions
|
@ -144,10 +144,9 @@ class _VideoViewerState extends State<VideoViewer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onPlayPressed() {
|
void _onPlayPressed() {
|
||||||
if (_isFinished) {
|
if (_controller.value.position == _controller.value.duration) {
|
||||||
_controller.seekTo(const Duration()).then((_) {
|
_controller.seekTo(const Duration()).then((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isFinished = false;
|
|
||||||
_play();
|
_play();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -168,18 +167,18 @@ class _VideoViewerState extends State<VideoViewer> {
|
||||||
if (!_controller.value.isInitialized) {
|
if (!_controller.value.isInitialized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!_isFinished) {
|
if (!_isFinished &&
|
||||||
if (_controller.value.position == _controller.value.duration) {
|
_controller.value.position == _controller.value.duration) {
|
||||||
setState(() {
|
_isFinished = true;
|
||||||
_isFinished = true;
|
setState(() {
|
||||||
_pause();
|
_pause();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _play() {
|
void _play() {
|
||||||
if (widget.canPlay) {
|
if (widget.canPlay) {
|
||||||
|
_isFinished = false;
|
||||||
_controller.play();
|
_controller.play();
|
||||||
widget.onPlay?.call();
|
widget.onPlay?.call();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue