Код: Выделить всё
final AudioPlayer _audioPlayer = AudioPlayer();
_audioPlayer.setReleaseMode(ReleaseMode.stop);
Future load(String url) async {
await _audioPlayer.setSource(UrlSource(url));
}
< /code>
Я получаю эти ошибки на Android, но я не вижу много деталей проблемы. < /p>
V/MediaPlayer(20411): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(20411): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaHTTPService(20411): MediaHTTPService(android.media.MediaHTTPService@2ee7d4e): Cookies: null
V/MediaHTTPService(20411): makeHTTPConnection: CookieManager created: java.net.CookieManager@20d4e6f
V/MediaHTTPService(20411): makeHTTPConnection(android.media.MediaHTTPService@2ee7d4e): cookieHandler: java.net.CookieManager@20d4e6f Cookies: null
I/DpmTcmClient(20411): RegisterTcmMonitor from: $Proxy1
E/MediaPlayerNative(20411): error (1, -2147483648)
E/MediaPlayer(20411): Error (1,-2147483648)
I/flutter (20411): AudioPlayers Exception: AudioPlayerException(
I/flutter (20411): UrlSource(url: http://213.165.70.5/samples/sample.mp3, mimeType: null),
I/flutter (20411): PlatformException(AndroidAudioError, Failed to set source. For troubleshooting, see: https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, MEDIA_ERROR_UNKNOWN {what:1}, MEDIA_ERROR_SYSTEM, null)
Это заголовки ответов сервера.
Код: Выделить всё
HTTP/2 200
cache-control: max-age=300
content-disposition: attachment; filename=sample.mp3
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: audio/mpeg
etag: "0c6a97bfdbd9bb80857a4bd5909669b91bdaed1d260e5c7fedfc049edc90bc0d"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: 851B:2EA3F6:6BBCB7:7464E6:68407A66
accept-ranges: bytes
date: Wed, 04 Jun 2025 16:55:03 GMT
via: 1.1 varnish
x-served-by: cache-toj-leto2350033-TOJ
x-cache: MISS
x-cache-hits: 0
x-timer: S1749056103.919178,VS0,VE435
vary: Authorization,Accept-Encoding
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: d4c10b7cc002a1a71013fd871c06fee996df5cea
expires: Wed, 04 Jun 2025 17:00:03 GMT
source-age: 0
content-length: 7373059
Код: Выделить всё
HTTP/1.1 200 OK
Server: nginx/1.24.0 (Ubuntu)
Date: Wed, 04 Jun 2025 16:55:09 GMT
Content-Type: audio/mpeg
Content-Length: 7373059
Last-Modified: Wed, 04 Jun 2025 16:28:07 GMT
Connection: keep-alive
ETag: "68407417-708103"
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST. OPTIONS, PUT, DELETE
Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization
Accept-Ranges: bytes
Подробнее здесь: https://stackoverflow.com/questions/796 ... st-android
Мобильная версия