question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS can't play audio when there is no file extension in the url

See original GitHub issue

🐛 Bug Report

I recently changed my file url to a id-based url. This caused iOS to fail playing audio with an error:

Error: An unknown error occurred (1869640813) - The AVPlayerItem instance has failed with the error code -11800 and domain “AVFoundationErrorDomain”.

Android works fine without the extension, ironically, I need a overrideFileExtensionIOS instead of overrideFileExtensionAndroid.

Both urls return a Content-Type: audio/mpeg header.

Summary of Issue

When playing an .m4a audio with no extension I get this error:

Error: An unknown error occurred (1869640813) - The AVPlayerItem instance has failed with the error code -11800 and domain “AVFoundationErrorDomain”.

Environment - output of expo diagnostics & the platform(s) you’re targeting

This happens with Expo SDK 37 and so far with any iPhone model

Steps to Reproduce

const sound = new Audio.Sound();
sound.loadAsync({
    uri: 'https//server.com/audiofile/download'
}) // throws error

sound.loadAsync({
    uri: 'https//server.com/audiofile/download.m4a'
}) // all good 

Expected Behavior vs Actual Behavior

Audio should play

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sarevok89commented, Mar 5, 2021

Update: I tried to first load the external uri as an Asset and passed that into Audio.Sound.createAsync() but no luck there either.

I literally ended up “fixing” it with if( isWeb || isIos ) return Linking.openURL( audioURI ).

Hey, could you give some more details on how you solved this? I’m struggling with the issue with Cloudfront signed URLs without file extensions.

0reactions
dev-abukecommented, Nov 17, 2022

Is there Anyone Who have found a solution for this issue, it’s still occurring.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to play movie files with no file extension on iOS ...
I've successfully used MPMoviePlayerController and AVPlayer to load files from a remote URL when the filename has a file extension. However, when I...
Read more >
If an audio or video file doesn't play on Mac
If that happens, your app won't open the file or won't play back its audio or video. How to search for an app...
Read more >
The Embed Audio element - HTML - MDN Web Docs - Mozilla
The HTML element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src...
Read more >
How to FIX “greyed out” MP3/audio files in GarageBand iPad ...
How to convert MP3 audio files that are "greyed out" in GarageBand iOS ( iPad / iPhone ) and import them ... Your...
Read more >
The 10 Most Common Audio Formats: Which One Should ...
You know about MP3, but what about AAC, FLAC, OGG, or WMA? Why do so many audio file formats exist and is there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found