mirror of
https://github.com/KRTirtho/spotube.git
synced 2026-05-08 16:24:36 +00:00
fix: increase mpv network timeout to reduce auto-skipping
This commit is contained in:
parent
9ca0e8bef2
commit
6d344c32a0
@ -74,9 +74,11 @@ extension ProxyPlaylistListeners on ProxyPlaylistNotifier {
|
|||||||
|
|
||||||
if (lastTrack == nextTrack.id) return;
|
if (lastTrack == nextTrack.id) return;
|
||||||
|
|
||||||
await ref.read(sourcedTrackProvider(nextTrack).future).whenComplete(() {
|
try {
|
||||||
|
await ref.read(sourcedTrackProvider(nextTrack).future);
|
||||||
|
} finally {
|
||||||
lastTrack = nextTrack.id!;
|
lastTrack = nextTrack.id!;
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -80,7 +80,24 @@ class PlaybackServer {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final audioStream = res.data?.stream as Stream<Uint8List>?;
|
final audioStream =
|
||||||
|
(res.data?.stream as Stream<Uint8List>?)?.asBroadcastStream();
|
||||||
|
|
||||||
|
// if (res.statusCode! > 300) {
|
||||||
|
// debugPrint(
|
||||||
|
// "[[Request]]\n"
|
||||||
|
// "URI: ${res.requestOptions.uri}\n"
|
||||||
|
// "Status: ${res.statusCode}\n"
|
||||||
|
// "Request Headers: ${res.requestOptions.headers}\n"
|
||||||
|
// "Response Body: ${res.data}\n"
|
||||||
|
// "Response Headers: ${res.headers.map}",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
audioStream!.listen(
|
||||||
|
(event) {},
|
||||||
|
cancelOnError: true,
|
||||||
|
);
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
res.statusCode!,
|
res.statusCode!,
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:catcher_2/catcher_2.dart';
|
import 'package:catcher_2/catcher_2.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:spotify/spotify.dart';
|
import 'package:spotify/spotify.dart';
|
||||||
import 'package:spotube/extensions/track.dart';
|
import 'package:spotube/extensions/track.dart';
|
||||||
import 'package:spotube/models/local_track.dart';
|
import 'package:spotube/models/local_track.dart';
|
||||||
@ -48,6 +49,7 @@ abstract class AudioPlayerInterface {
|
|||||||
: _mkPlayer = CustomPlayer(
|
: _mkPlayer = CustomPlayer(
|
||||||
configuration: const mk.PlayerConfiguration(
|
configuration: const mk.PlayerConfiguration(
|
||||||
title: "Spotube",
|
title: "Spotube",
|
||||||
|
logLevel: kDebugMode ? mk.MPVLogLevel.info : mk.MPVLogLevel.error,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
// _justAudio = !_mkSupportedPlatform ? ja.AudioPlayer() : null
|
// _justAudio = !_mkSupportedPlatform ? ja.AudioPlayer() : null
|
||||||
|
|||||||
@ -25,6 +25,8 @@ class CustomPlayer extends Player {
|
|||||||
: _playerStateStream = StreamController.broadcast(),
|
: _playerStateStream = StreamController.broadcast(),
|
||||||
_shuffleStream = StreamController.broadcast(),
|
_shuffleStream = StreamController.broadcast(),
|
||||||
_shuffled = false {
|
_shuffled = false {
|
||||||
|
nativePlayer.setProperty("network-timeout", "120");
|
||||||
|
|
||||||
_subscriptions = [
|
_subscriptions = [
|
||||||
stream.buffering.listen((event) {
|
stream.buffering.listen((event) {
|
||||||
_playerStateStream.add(AudioPlaybackState.buffering);
|
_playerStateStream.add(AudioPlaybackState.buffering);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user