Skip to content

Commit

Permalink
core: shortcut detect non-existing tracks when playing
Browse files Browse the repository at this point in the history
and some playback fixes
  • Loading branch information
MSOB7YY committed Jun 7, 2024
1 parent 8c450fd commit 895fc4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions lib/base/audio_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ class NamidaAudioVideoHandler<Q extends Playable> extends BasicAudioHandler<Q> {
});

Future<Duration?> 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,
Expand Down Expand Up @@ -536,6 +537,8 @@ class NamidaAudioVideoHandler<Q extends Playable> extends BasicAudioHandler<Q> {
}
}

if (tr.path.startsWith('/namida_dummy/')) return;

try {
duration = await setPls();
if (checkInterrupted()) return;
Expand Down Expand Up @@ -633,7 +636,7 @@ class NamidaAudioVideoHandler<Q extends Playable> extends BasicAudioHandler<Q> {
);
}
}
if (wasPlaying) await onPlayRaw();
if (wasPlaying) onPlayRaw();
}
}

Expand Down Expand Up @@ -698,7 +701,7 @@ class NamidaAudioVideoHandler<Q extends Playable> extends BasicAudioHandler<Q> {
}
await seek(position.value.milliseconds);
if (wasPlaying) {
await onPlayRaw();
onPlayRaw();
}
}
}
Expand Down Expand Up @@ -804,8 +807,7 @@ class NamidaAudioVideoHandler<Q extends Playable> extends BasicAudioHandler<Q> {

Future<void> plsplsplsPlay(bool wasPlayingFromCache, bool sourceChanged) async {
if (startPlaying()) {
setVolume(_userPlayerVolume);
await onPlayRaw();
onPlayRaw();
}
if (sourceChanged) {
await seek(currentPositionMS.value.milliseconds);
Expand Down Expand Up @@ -1419,7 +1421,7 @@ class NamidaAudioVideoHandler<Q extends Playable> extends BasicAudioHandler<Q> {
}
_isCurrentAudioFromCache = true;
await plsSeek();
if (wasPlaying) await onPlayRaw();
if (wasPlaying) onPlayRaw();
} else {
await plsSeek();
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 895fc4c

Please sign in to comment.