mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-14 08:25:16 +00:00

* refactor: remove SourcedTrack based audio player and utilize mediakit playback system * feat: implement local (loopback) server to resolve stream source and leverage the media_kit playback API * feat: add source change support and re-add prefetching tracks * fix: assign lastId when track fetch completes regardless of error * chore: remove print statements * fix: remote queue not working * fix: increase mpv network timeout to reduce auto-skipping * fix: do not pre-fetch local tracks * fix(proxy-playlist): reset collections on load * chore: fix lint warnings * fix(mobile): player overlay should not be visible when the player is not playing * chore: fix typo in turkish translation * cd: checkout PR branch * cd: upgrade flutter version * chore: fix lint errors
29 lines
837 B
Dart
29 lines
837 B
Dart
import 'package:collection/collection.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:spotify/spotify.dart';
|
|
import 'package:spotube/models/local_track.dart';
|
|
import 'package:spotube/provider/proxy_playlist/proxy_playlist_provider.dart';
|
|
import 'package:spotube/services/sourced_track/sourced_track.dart';
|
|
|
|
final sourcedTrackProvider =
|
|
FutureProvider.family<SourcedTrack?, Track?>((ref, track) async {
|
|
if (track == null || track is LocalTrack) {
|
|
return null;
|
|
}
|
|
|
|
ref.listen(
|
|
ProxyPlaylistNotifier.provider,
|
|
(old, next) {
|
|
if (next.tracks.isEmpty ||
|
|
next.tracks.none((element) => element.id == track.id)) {
|
|
ref.invalidateSelf();
|
|
}
|
|
},
|
|
);
|
|
|
|
final sourcedTrack =
|
|
await SourcedTrack.fetchFromTrack(track: track, ref: ref);
|
|
|
|
return sourcedTrack;
|
|
});
|