fix(playback): skipping tracks with unplayable sources instead of falling back #1492

This commit is contained in:
Kingkor Roy Tirtho 2024-06-02 22:34:06 +06:00
parent 56241f773a
commit c607a330ed
3 changed files with 22 additions and 16 deletions

View File

@ -135,16 +135,10 @@ abstract class SourcedTrack extends Track {
return await PipedSourcedTrack.fetchFromTrack(track: track, ref: ref);
} catch (e) {
if (e is DioException || e is ClientException || e is SocketException) {
if (preferences.audioSource == AudioSource.jiosaavn) {
return await JioSaavnSourcedTrack.fetchFromTrack(
track: track,
ref: ref,
weakMatch: true,
);
}
return await JioSaavnSourcedTrack.fetchFromTrack(
track: track,
ref: ref,
weakMatch: preferences.audioSource == AudioSource.jiosaavn,
);
}
rethrow;

View File

@ -1,3 +1,4 @@
import 'package:catcher_2/core/catcher_2.dart';
import 'package:collection/collection.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:http/http.dart';
@ -221,6 +222,7 @@ class YoutubeSourcedTrack extends SourcedTrack {
final ytLink = links.firstWhereOrNull((link) => link.platform == "youtube");
if (ytLink?.url != null) {
try {
return [
await toSiblingType(
0,
@ -229,6 +231,10 @@ class YoutubeSourcedTrack extends SourcedTrack {
),
)
];
} on VideoUnplayableException catch (e, stack) {
// Ignore this error and continue with the search
Catcher2.reportCheckedError(e, stack);
}
}
final query = SourcedTrack.getSearchTerm(track);

View File

@ -24,7 +24,13 @@ ThemeData theme(Color seed, Brightness brightness, bool isAmoled) {
horizontalTitleGap: 5,
iconColor: scheme.onSurface,
),
appBarTheme: const AppBarTheme(surfaceTintColor: Colors.transparent),
appBarTheme: const AppBarTheme(
surfaceTintColor: Colors.transparent,
scrolledUnderElevation: 0,
shadowColor: Colors.transparent,
elevation: 0,
backgroundColor: Colors.transparent,
),
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),