howler.js icon indicating copy to clipboard operation
howler.js copied to clipboard

Requests for mp3s are being immediately cancelled in Android (Cordova) using Howler 2.0

Open FullR opened this issue 10 years ago • 8 comments

When trying to load sounds on Android in my Cordova application, they aren't failing to load (onloaderror isn't being called), but when they are played, they are silent and never end. In the Network tab of the chrome inspector, it's showing the sounds as being requested (GET status "Success") but then immediately after the same file is showed as cancelled (status "(cancelled)").

This code works fine in iOS and Chrome.

Howler 2.0.0 Cordova 6.0.0

FullR avatar Aug 31 '16 19:08 FullR

Hi @FullR , exactly the same issue. see my screenshot. Any luck? image

makdas avatar Nov 28 '16 08:11 makdas

@makdas I think the issue I was having was caused by HTML5 audio not being supported because the device was running an older version of Android. I ended up creating an Android specific build using the Cordova media plugin.

FullR avatar Dec 02 '16 03:12 FullR

@FullR can you please share some code of you implementation... I've tried https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-media/#installation but get a error : Unknown provider: $cordovaMediaProvider <- $cordovaMedia

.controller('MyCtrl', ['$cordovaMedia', function($cordovaMedia){ console.log($cordovaMedia); }])

makdas avatar Dec 06 '16 10:12 makdas

@makdas I was just accessing Media through the global scope after deviceready was emitted. It looks like you need to write a provider for the media plugin.

FullR avatar Dec 07 '16 04:12 FullR

Thanks, I managed to get it working with the media plugin. Would have liked howler to work with cordova android.

makdas avatar Dec 07 '16 05:12 makdas

I haven't used Cordova before, any idea why it wasn't working without the plugin? Is there no HTML5/Web Audio without it?

goldfire avatar Dec 07 '16 13:12 goldfire

I finally got it to work using the crosswalk webkit browser. For all Cordova/Ionic app builders. Follow this https://crosswalk-project.org/documentation/cordova.html and use ogg audio files. ;)

makdas avatar Dec 07 '16 13:12 makdas

Closing due to inactivity. If this is still an issue, reply with more info and I'll reopen.

goldfire avatar Jun 21 '20 16:06 goldfire