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 =>
|
Track? get activeTrack =>
|
||||||
active == null ? null : tracks.elementAtOrNull(active!);
|
active == null || active == -1 ? null : tracks.elementAtOrNull(active!);
|
||||||
|
|
||||||
bool get isFetching =>
|
bool get isFetching =>
|
||||||
activeTrack != null &&
|
activeTrack != null &&
|
||||||
|
@ -80,6 +80,8 @@ class ProxyPlaylistNotifier extends StateNotifier<ProxyPlaylist>
|
|||||||
(element) => element.id == state.activeTrack?.id,
|
(element) => element.id == state.activeTrack?.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (newIndex == -1) return;
|
||||||
|
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
tracks: newlyOrderedTracks.toSet(),
|
tracks: newlyOrderedTracks.toSet(),
|
||||||
active: newIndex,
|
active: newIndex,
|
||||||
|
@ -74,7 +74,9 @@ class SpotubeAudioPlayer {
|
|||||||
.asyncMap(
|
.asyncMap(
|
||||||
(position) async => (await duration)?.inSeconds == 0
|
(position) async => (await duration)?.inSeconds == 0
|
||||||
? 0
|
? 0
|
||||||
: (position.inSeconds / (await duration)!.inSeconds * 100)
|
: (position.inSeconds /
|
||||||
|
((await duration)?.inSeconds ?? 100) *
|
||||||
|
100)
|
||||||
.toInt(),
|
.toInt(),
|
||||||
)
|
)
|
||||||
.where((event) => event >= percent)
|
.where((event) => event >= percent)
|
||||||
@ -383,10 +385,10 @@ class SpotubeAudioPlayer {
|
|||||||
if (mkSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _mkPlayer!.playlist.medias.map((e) => e.uri).toList();
|
return _mkPlayer!.playlist.medias.map((e) => e.uri).toList();
|
||||||
} else {
|
} else {
|
||||||
return (_justAudio!.audioSource as ja.ConcatenatingAudioSource)
|
return _justAudio!.sequenceState?.effectiveSequence
|
||||||
.children
|
.map((e) => (e as ja.UriAudioSource).uri.toString())
|
||||||
.map((e) => (e as ja.UriAudioSource).uri.toString())
|
.toList() ??
|
||||||
.toList();
|
<String>[];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user