mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
fix: null exception on proxy playlist and audio player
This commit is contained in:
parent
696eeee882
commit
a455a89c58
@ -19,7 +19,7 @@ class ProxyPlaylist {
|
||||
}
|
||||
|
||||
Track? get activeTrack =>
|
||||
active == null ? null : tracks.elementAtOrNull(active!);
|
||||
active == null || active == -1 ? null : tracks.elementAtOrNull(active!);
|
||||
|
||||
bool get isFetching =>
|
||||
activeTrack != null &&
|
||||
|
@ -80,6 +80,8 @@ class ProxyPlaylistNotifier extends StateNotifier<ProxyPlaylist>
|
||||
(element) => element.id == state.activeTrack?.id,
|
||||
);
|
||||
|
||||
if (newIndex == -1) return;
|
||||
|
||||
state = state.copyWith(
|
||||
tracks: newlyOrderedTracks.toSet(),
|
||||
active: newIndex,
|
||||
|
@ -74,7 +74,9 @@ class SpotubeAudioPlayer {
|
||||
.asyncMap(
|
||||
(position) async => (await duration)?.inSeconds == 0
|
||||
? 0
|
||||
: (position.inSeconds / (await duration)!.inSeconds * 100)
|
||||
: (position.inSeconds /
|
||||
((await duration)?.inSeconds ?? 100) *
|
||||
100)
|
||||
.toInt(),
|
||||
)
|
||||
.where((event) => event >= percent)
|
||||
@ -383,10 +385,10 @@ class SpotubeAudioPlayer {
|
||||
if (mkSupportedPlatform) {
|
||||
return _mkPlayer!.playlist.medias.map((e) => e.uri).toList();
|
||||
} else {
|
||||
return (_justAudio!.audioSource as ja.ConcatenatingAudioSource)
|
||||
.children
|
||||
return _justAudio!.sequenceState?.effectiveSequence
|
||||
.map((e) => (e as ja.UriAudioSource).uri.toString())
|
||||
.toList();
|
||||
.toList() ??
|
||||
<String>[];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user