New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVPlayerItemStatus.failed #213
Comments
Add following code to your Info.plist <key>NSAppTransportSecurity</key>
<dict>
<!--Include to allow all connections (DANGER)-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict> to make your app load an HTTP URL. |
Thanks for the response, @kennenfromchina :) This is already mentioned in our readme, under "iOS App Transport Security" So I'll close this, please let us know if any other problems arise o/ |
I have that in my |
Ok, reoping then. I'm not sure what or who is throwing this error. This needs to be investigated further. |
change androidEncoder, such as AndroidEncoder.HE_AAC |
I had the same problem, fixed it by using the correct path to the sound file, so recommend to check that again. |
@darren-f5s In your case you have to set isLocal: false. |
I am facing the same issue. I tried on Android and iOS and it is not working at all. I gave this in my iOS plist
I enabled Log for Audio Player and also, I logged the events as well. It comes as this flutter: result is ----> 1 Flutter Doctor -v results [✓] Flutter (Channel beta, v1.12.13+hotfix.6, on Mac OS X 10.14.6 18G103, locale en-IN) [✓] Xcode - develop for iOS and macOS (Xcode 10.2.1) [✓] Connected device (3 available) The music url is http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1xtra_mf_p This is the way I am playing the audio file
in my pubspec.yaml I have added audioplayers: only so that the latest version plays. |
Hello, I have also the same problem as @Debsuv and @darren-f5s. The only further information I can add to what is have been already said is that the error seems to depend either on the format of the URL or the headers the server is using to distribute the audio file. I have this suspicion because I was able to make the same mp3 file to work or not depending if it was stored in a plain public bucket or a more complex link with autogenerated URL security key. For Android it worked in all cases. |
Any update on this? I am able to play all my audio on Android but on iOS it will fail to load 30% of the time. I am getting my audio files from the Google server which is HTTPS. |
I just realized that iOS can't open correctly an audio file if you don't provide the right extension. |
@matitalatina I can confirm, we solved this error in iOS by specifying the extension on the remote file link too, not only locally. Now streaming also works. |
I also resolved this issue by restarting my iPhone... If filepath & permissions are OK you might have a try! |
In my own case, this occurs when I am not connected to the internet. I noticed my WiFi got disconnected while streaming songs from remote url and of a sudden began logging this error maybe that could be yours else everything works fine when online |
I fear this is why it will not work for me, but adding the extension seems to break even files that were playing before. I'm trying to play from Firebase storage links, will that make it not possible with access restrictions to actually link to the file with the extension? What's weird is that iOS will play some shorter (< 10 seconds) files just fine if recorded on an Android (encoding: AAC), but not files longer than that. It will play a file recorded and uploaded from iOS just fine no matter the length. I'm recording and uploading the iOS files as '.m4a' and uploads from android recordings as '.mp3'. I also didn't used to have this problem (~6 months ago), but just revived an old project and noticed this happening now. |
Thanks to @matitalatina and @joseluissb . I encountered the same error. Then I checked my code again and found that the file extension was wrong set
|
You mentioned you solved this problem when pulling files with URLs from a Google server? Can you expand a little bit on what you had to do for this? I can't seem to get this to work, even if I add the file extension (which isn't always the same, so eventually I'll have to find a way to determine this from the file, but right now I'm just trying by hardcoding the file extension to the URL in the my For reference I'm trying to play files from Firebase storage, and the url's don't seem to have an extension on them either |
final result = mediaBox.containsKey(url) I'm playing local files if it is available and if it's not then playing from the remote file. Its working fine in android but in ios, a remote file is being played but when playing local file it is giving the AVPlayerItemStatus.failed error. Any help will be great. |
This issue is outdated or uses a very old version of the project, could you please test if this happens on newer versions? And in case that this still happens, open a new issue? |
The problem happened to me when I started screen recording application called "Capto" to record screen and capture computer audio with Simulator audio of iOS. The fix was just restarting iOS simulator |
I'm facing the same error I try with version 0.20.* and now I'm trying with 1.0.1 that also give me the same problem thanks in advance for any suggestion ps: @luanpotter this isnt close yet please reopen |
Here is the code I am using:
And I get the error code: Latest Audioplayers version |
Same issue, on iOS only I get the AVPlayerItem.Status.failed when trying to play a file stored on the device. Confirmed it exists before attempting to play the file. |
That's how I solved the problem Example 1. Fails with the error: AVPlayerItemStatus.failed Example 2. Works like a charm |
For me, I was using mp3 as contentType in metadata of a file and saving it to the firebase cloud storage, replaced it with .aac and it started working.
|
Much like this issue: #62
Playing audio files from a remote URL on iOS (Simulator and device) fails with the error:
AVPlayerItemStatus.failed
The text was updated successfully, but these errors were encountered: