cordova-plugin-nativeaudio icon indicating copy to clipboard operation
cordova-plugin-nativeaudio copied to clipboard

PreloadSimple and PreloadComplex not working

Open appstagedarren opened this issue 6 years ago • 3 comments

Hi there

I recently updated my Galaxy Tab with the latest version of Android and all the audio in my app (which was previously working before the update) now does not work.

PreloadSimple returns a success and alerts "OK", but still the audio wont play. PreloadComplex returns an error callback with the message "OK" as well, definitely wont play.

When i try and play the SIMPLE audio file, it jumps straight to the callback without playing a thing.

Please let me know what the solution might be.

I reiterate, the audio was playing absolutely perfectly until the latest Android OS update.

Kind regards, Darren

appstagedarren avatar Nov 27 '17 10:11 appstagedarren

I have identified where the issue lies.

With the upgraded Android API version, it now requires you to use the FileProvider and specify where you can read files from within your app.

https://developer.android.com/reference/android/support/v4/content/FileProvider.html#SpecifyFiles

I have not yet solved the issue, just got some direction.

appstagedarren avatar Nov 27 '17 16:11 appstagedarren

Any progress on this?

eamers avatar Jan 22 '18 18:01 eamers

I solved my own issue. It was not what i initially thought but rather i had one function to preload all the audio files and then call them as i needed them.

It appears that the newer version of Android couldn't hold all of the preloaded audio in temporary memory and they weren't available when play was requested. So i only preloaded the audio i needed as i landed in certain sections of the app, then unloaded them when the user left those sections.

It was more programming error than anything.

appstagedarren avatar Jan 23 '18 07:01 appstagedarren