diff --git a/lib/ui/music_player.dart b/lib/ui/music_player.dart index 1ae8fc8..0240357 100644 --- a/lib/ui/music_player.dart +++ b/lib/ui/music_player.dart @@ -59,7 +59,15 @@ class _MusicPlayerState extends State { autoPlay: true, showControls: false); - _videoPlayerController!.addListener(() => setState(() {})); + _videoPlayerController!.addListener(() => setState(() { + // Automatically play next music if required + if (_videoPlayerController != null && _duration == _position) { + if (_duration?.inSeconds == _position?.inSeconds && + (_duration?.inSeconds ?? 0) > 0) { + _playNext(); + } + } + })); } }