cordova-plugin-media
cordova-plugin-media copied to clipboard
feat: Implement playing audio in background
Platforms affected
- Android
- iOS
On iOS, I only added a startPlayingAudioInBackground
that's a proxy tostartPlayingAudio
because the latter already plays the audio in a background thread.
Motivation and Context
Playing audio in a separate thread on Android greatly improved the performance of our apps.
Description
I added Media.prototype.playInBackground
to the javascript interface.
I added the method startPlayingAudioInBackground
to both Android and iOS native interfaces.
Testing
The changes are pretty minimal. I installed the plugin in a new cordova project and tested it manually.
Can you please add some documentation in README.md
about this @adriano-di-giovanni? Thanks.
@janpio, done. Thanks.
CI, please rerun the tests with current configuration.
As iOS already runs the play command in a background thread anyway, why not just update Android to have the same behaviour by default? No need to introduce any new functions then and the change is backward compatible with any existing implementation of the plugin.