AVPlayer can't play an icecast URL, but safarir can play it

PlayerItem's status changed to AVPlayerItemStatusFailed in observeValueForKeyPath, and the error is:

PlayerItem status failed: Error Domain=AVFoundationErrorDomain Code=-11850 "Operation Stopped" UserInfo={NSLocalizedFailureReason=The server is not correctly configured., NSLocalizedDescription=Operation Stopped, NSUnderlyingError=0x281e535a0 {Error Domain=CoreMediaErrorDomain Code=-12939 "byte range and no content length - error code is 200" UserInfo={NSDescription=byte range and no content length - error code is 200, NSURL=https://icecast.walmradio.com:8443/walm2_opus}}}

The stream URL is https://icecast.walmradio.com:8443/walm2_opus

Both safari and chrome can play it.

CURL output is as the following:

curl -v "https://icecast.walmradio.com:8443/walm2_opus"

  • Trying 185.217.92.116:8443...
  • Connected to icecast.walmradio.com (185.217.92.116) port 8443 (#0)
  • ALPN: offers h2,http/1.1
  • (304) (OUT), TLS handshake, Client hello (1):
  • CAfile: /etc/ssl/cert.pem
  • CApath: none
  • (304) (IN), TLS handshake, Server hello (2):
  • TLSv1.2 (IN), TLS handshake, Certificate (11):
  • TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  • TLSv1.2 (IN), TLS handshake, Server finished (14):
  • TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  • TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
  • TLSv1.2 (OUT), TLS handshake, Finished (20):
  • TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
  • TLSv1.2 (IN), TLS handshake, Finished (20):
  • SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
  • ALPN: server accepted http/1.1
  • Server certificate:
  • subject: CN=*.walmradio.com
  • start date: Aug 7 01:02:56 2023 GMT
  • expire date: Nov 5 01:02:55 2023 GMT
  • subjectAltName: host "icecast.walmradio.com" matched cert's "*.walmradio.com"
  • issuer: C=US; O=Let's Encrypt; CN=R3
  • SSL certificate verify ok.
  • using HTTP/1.1

GET /walm2_opus HTTP/1.1 Host: icecast.walmradio.com:8443 User-Agent: curl/7.88.1 Accept: /

< HTTP/1.1 200 OK < Server: nginx < Date: Sat, 26 Aug 2023 19:15:20 GMT < Content-Type: audio/ogg < Transfer-Encoding: chunked < Connection: keep-alive < Cache-Control: no-cache, no-store < Expires: Mon, 26 Jul 1997 05:00:00 GMT < Pragma: no-cache < Access-Control-Allow-Origin: * < X-Robots-Tag: index, noarchive < ice-audio-info: ice-bitrate=192;ice-channels=2;ice-samplerate=48000 < icy-pub: 1 < icy-index-metadata: 1 < icy-logo: https://icecast.walmradio.com:8443/walm.jpg < icy-country-code: US < icy-country-subdivision-code: US-NY < icy-language-codes: en < icy-main-stream-url: https://icecast.walmradio.com:8443/walm2_opus < icy-geo-lat-long: 40.75166,-73.97538 < icy-br: 192 < icy-genre: Traditional Christian,Hymns,Orchestral,Classical Music,Choral,Christian,Christian Music,Talk Radio,Talk,Opus < icy-name: WALM 2 (Opus) < icy-description: Music of Faith < icy-url: https://walmradio.com/walm2 < Warning: Binary output can mess up your terminal. Use "--output -" to tell Warning: curl to output it to your terminal anyway, or consider "--output Warning: <FILE>" to save to a file.

  • Failure writing output to destination
  • Failed reading the chunked-encoded stream
  • Closing connection 0
  • TLSv1.2 (OUT), TLS alert, close notify (256):

Having the same issue here, does anyone have a solution?

AVPlayer can't play an icecast URL, but safarir can play it
 
 
Q