1 year ago
#294162
Andriy Antonov
just_audio SocketException
When I am trying to open a source (url) without the internet on the device (flight mode on), I receive the next logs:
[ +1 ms] flutter: SocketException: Failed host lookup: 'raw.githubusercontent.com' (OS Error: nodename nor servname provided, or not known, errno = 8)
[ +1 ms] flutter:
#0 _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:682:35)
#1 _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1817:26)
#2 RawSocket.startConnect (dart:io-patch/socket_patch.dart:27:23)
#3 RawSecureSocket.startConnect (dart:io/secure_socket.dart:237:22)
#4 SecureSocket.startConnect (dart:io/secure_socket.dart:60:28)
#5 _ConnectionTarget.connect (dart:_http/http_impl.dart:2438:24)
#6 _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2834:12)
#7 _HttpClient._getConnection (dart:_http/http_impl.dart:2839:12)
#8 _HttpClient._openUrl (dart:_http/http_impl.dart:2698:12)
#9 _HttpClient.getUrl (dart:_http/http_impl.dart:2575:48)
#10 _proxyHandlerForUri.handler (package:just_audio/just_audio.dart:3039:46)
#11 _proxyHandlerForUri.handler (package:just_audio/just_audio.dart:3038:23)
#12 _ProxyHttpServer.start.<anonymous closure> (package:just_audio/just_audio.dart:1946:16)
#13 _ProxyHttpServer.start<…>
try/catch doesn't help...
Any advice or idea?
UPDATE:
It take me some time to debug example app and compare with mine.
The issue comes cos I use headers with my source
.
Here is piece of code from library, where dramattic change happened:
@override
Future<void> _setup(AudioPlayer player) async {
await super._setup(player);
if (uri.scheme == 'asset') {
_overrideUri = await _loadAsset(uri.pathSegments.join('/'));
} else if (uri.scheme != 'file' &&
!kIsWeb &&
(headers != null || player._userAgent != null)) {
await player._proxy.ensureRunning();
_overrideUri = player._proxy.addUriAudioSource(this);
}
}
we are interested in this particular line:
(headers != null || player._userAgent != null)) {
I use headers, so in my app code goes futher, and then fails inside _proxyHandlerForUri
, line 3039.
socketexception
just-audio
0 Answers
Your Answer