From 895fc4cf1f049677572e85e6ca1db688332186a5 Mon Sep 17 00:00:00 2001 From: MSOB7YY Date: Fri, 7 Jun 2024 16:42:00 +0300 Subject: [PATCH] core: shortcut detect non-existing tracks when playing and some playback fixes --- lib/base/audio_handler.dart | 12 +++++++----- pubspec.yaml | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/base/audio_handler.dart b/lib/base/audio_handler.dart index 74e4bb8e..276d770a 100644 --- a/lib/base/audio_handler.dart +++ b/lib/base/audio_handler.dart @@ -504,6 +504,7 @@ class NamidaAudioVideoHandler extends BasicAudioHandler { }); Future setPls() async { + if (!File(tr.path).existsSync()) throw PathNotFoundException(tr.path, const OSError(), 'Track file not found or couldn\'t be accessed.'); final dur = await setSource( tr.toAudioSource(currentIndex.value, currentQueue.length), item: pi, @@ -536,6 +537,8 @@ class NamidaAudioVideoHandler extends BasicAudioHandler { } } + if (tr.path.startsWith('/namida_dummy/')) return; + try { duration = await setPls(); if (checkInterrupted()) return; @@ -633,7 +636,7 @@ class NamidaAudioVideoHandler extends BasicAudioHandler { ); } } - if (wasPlaying) await onPlayRaw(); + if (wasPlaying) onPlayRaw(); } } @@ -698,7 +701,7 @@ class NamidaAudioVideoHandler extends BasicAudioHandler { } await seek(position.value.milliseconds); if (wasPlaying) { - await onPlayRaw(); + onPlayRaw(); } } } @@ -804,8 +807,7 @@ class NamidaAudioVideoHandler extends BasicAudioHandler { Future plsplsplsPlay(bool wasPlayingFromCache, bool sourceChanged) async { if (startPlaying()) { - setVolume(_userPlayerVolume); - await onPlayRaw(); + onPlayRaw(); } if (sourceChanged) { await seek(currentPositionMS.value.milliseconds); @@ -1419,7 +1421,7 @@ class NamidaAudioVideoHandler extends BasicAudioHandler { } _isCurrentAudioFromCache = true; await plsSeek(); - if (wasPlaying) await onPlayRaw(); + if (wasPlaying) onPlayRaw(); } else { await plsSeek(); } diff --git a/pubspec.yaml b/pubspec.yaml index 07d79aca..c636a1af 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: namida description: A Beautiful and Feature-rich Music Player, With YouTube & Video Support Built in Flutter publish_to: "none" -version: 2.6.8-beta+240607135 +version: 2.6.9-beta+240607136 environment: sdk: ">=3.4.0 <4.0.0"