416 error on offline download

Issue Description:

I am having issues when trying to offline music, I am using navidrome which is sitting behind caddy v2. It is reporting that the server is returning a 416 error.

I was asked in the ticket to post here with app logs.

Logs:

debug-20230329_112116.zip (69.6 KB)

Screenshots:

Additional information:

2023-03-29 11:21:03.254 Verbose/DownloaderService: Download url: https://xxx/rest/stream.view?id=ad09e6d52cd5647bb073d2c3acadc350 -> 83F9BD4CCA5B59BD5676155D1DDEF867
2023-03-29 11:21:03.254 Verbose/DownloaderService: Partial file exists: /storage/emulated/0/Android/data/app.symfonik.music.player/files/OfflineMedias/8/83F9BD4CCA5B59BD5676155D1DDEF867.flac.part
2023-03-29 11:21:03.255 Verbose/DownloaderService: Debug 83F9BD4CCA5B59BD5676155D1DDEF867 [0 ms] callStart: Request{method=GET, url=https://xxx/rest/stream.view?id=ad09e6d52cd5647bb073d2c3acadc350, headers=[Accept-Encoding:, connection:close, Range:bytes=12912783-]}
2023-03-29 11:21:03.256 Verbose/DownloaderService: --> [338] GET https://xxx/rest/stream.view?id=ad09e6d52cd5647bb073d2c3acadc350
2023-03-29 11:21:03.256 Verbose/DownloaderService: Debug 83F9BD4CCA5B59BD5676155D1DDEF867 [0 ms] connectionAcquired: Connection{xxx:443, proxy=DIRECT hostAddress=xxx/71.75.72.123:443 cipherSuite=TLS_AES_128_GCM_SHA256 protocol=h2}
2023-03-29 11:21:03.256 Verbose/DownloaderService: Debug 83F9BD4CCA5B59BD5676155D1DDEF867 [0 ms] requestHeadersStart
2023-03-29 11:21:03.256 Verbose/DownloaderService: Debug 83F9BD4CCA5B59BD5676155D1DDEF867 [1 ms] requestHeadersEnd
2023-03-29 11:21:03.266 Verbose/DownloaderService: Debug 83F9BD4CCA5B59BD5676155D1DDEF867 [11 ms] responseHeadersStart
2023-03-29 11:21:03.267 Verbose/DownloaderService: Debug 83F9BD4CCA5B59BD5676155D1DDEF867 [11 ms] responseHeadersEnd: Response{protocol=h2, code=416, message=, url=https://xxx/rest/stream.view?id=ad09e6d52cd5647bb073d2c3acadc350&u=REDACTED&t=REDACTED&s=REDACTED&v=1.13.0&c=Symfonium&f=json}
2023-03-29 11:21:03.267 Verbose/DownloaderService: <-- [338] 416  https://xxx/rest/stream.view?id=ad09e6d52cd5647bb073d2c3acadc350&u=REDACTED&t=REDACTED&s=REDACTED&v=1.13.0&c=Symfonium&f=json (10ms, 33-byte body)
2023-03-29 11:21:03.268 Verbose/DownloaderService: Debug 83F9BD4CCA5B59BD5676155D1DDEF867 [11 ms] responseBodyStart
2023-03-29 11:21:03.268 Verbose/DownloaderService: Debug 83F9BD4CCA5B59BD5676155D1DDEF867 [11 ms] responseBodyEnd: byteCount=0
2023-03-29 11:21:03.269 Verbose/DownloaderService: Debug 83F9BD4CCA5B59BD5676155D1DDEF867 [11 ms] connectionReleased
2023-03-29 11:21:03.269 Verbose/DownloaderService: Debug 83F9BD4CCA5B59BD5676155D1DDEF867 [11 ms] callEnd

So there’s download issues and when the app tries to resume the download the server refuse the range.

You need to check Navidrome and Caddy logs to see who fails here.

You can enable the advanced settings Slower downloads to workaround those issues.

Next release will try to better recover from error 416 to avoid being stuck in that state.