bug: Failed to load resource: net::ERR_FAILED on multiple audio streams
Bug Report
Capacitor Version
Latest Dependencies:
@capacitor/cli: 4.0.1
@capacitor/core: 4.0.1
@capacitor/android: 4.0.1
@capacitor/ios: 4.0.1
Installed Dependencies:
@capacitor/ios: not installed
@capacitor/cli: 4.0.1
@capacitor/core: 4.0.1
@capacitor/android: 4.0.1
[success] Android looking great! 👌
Platform(s)
Android (device runs Android 8.0)
Current Behavior
Loading audio through Javascript like this new Audio("assets/audio/sfx/audio.mp3") results in a Failed to load resource: net::ERR_FAILED. Strangely enough, this doesn't affect all audio files. Some of them load correctly, others seem to be partially loaded (the audio interrupts and loops itself) and others won't load at all. Furthermore, everytime I run the app, the list of affected audio files changes, so it appears to be random.
Android Studio logcat file confirms the issue with the loading: E/Capacitor/Console: File: http://localhost/lib/lib.js - Line 84 - Msg: Uncaught (in promise) NotSupportedError: The element has no supported sources.
Content Security Policy tag is set to: <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
I've also tested the same app on the same device but using Apache Cordova and I cannot reproduce the error, works like a charm. Maybe it's a WebView issue?
Expected Behavior
Audio files loaded via Javascript should work out of the box.
Code Reproduction
Other Technical Details
npm --version output: 8.11.0
node --version output: v18.3.0
pod --version output (iOS issues only):
Additional Context
This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.
Please see the Contributing Guide for how to create a Code Reproduction.
Thanks! Ionitron 💙
It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.
Have a great day! Ionitron 💙