04-12-2013 01:19 PM
I am using the normal HTML5 audio API to play short sound clips from my Webworks app (triggered by a timer). Unfortunately, whenever one of these audio prompts plays, it cancels any track being played by the music app, or any other app that is playing music in the background. If you press volume up/down after the sound effect has played you can see the sound effect name in the dialog as well.
Does anyone have a tip to prevent webworks audio from cancelling background audio?
04-16-2013 08:19 PM
Which platform/OS version is this on? I do recall a time where we did not support multi-channel audio but it should function on BlackBerry 10 / later PlayBook builds. I'll try to dig up the point where the change occurred.
04-18-2013 12:33 PM
On BlackBerry 10 (I believe PlayBook works the same), there can only be a single audio source playing at once. By audio source I mean a single application. So the native music app is a example. So is a WebWorks app. They all hook in to the native multimedia framework, which will stop all existing audio to play the most recent one.
This is by design.
04-19-2013 02:33 PM
Thanks for the clarification Anzor. This really is unfortunate for any app that wants to provide an audio cue or sound effect in a context where users would also want to play music from their libraries (e.g., any kind of exercise app). Does this mean there is no way for an app then to pause any existing music, play their sound, and resume whatever was previously playing, not even with a native extension?
04-21-2013 04:30 PM
@rtholmes Couldn't you play music files from your application itself rather then invoking the Music player. Then you wouldn't have to worry about pausing the music and restarting it.
04-21-2013 04:33 PM
05-02-2013 04:49 PM
"Only one app can make sounds at the same time" <-- This is ONLY true if the app is using the NowPlayingConnection service.
The browser app does use the NowPlayingConnection service by default - that would explain the behavour.
However, you can choose to have applications (for example, if making native extensions) where you don't hook into the NowPlayingConnection service. Multiple apps can make sounds at the same time; but not always recommended.
05-02-2013 04:54 PM
As far as I know (and the web experts can correct me here as appropriate), the HTML5 audio tags are played through the browser, which ties in to the underlying multimedia platform. The browser app happens to use the NowPlayingConnection service by default, for which you are seeing this behaviour.
You can try to make a native extension for the playback of your sounds. You can do it through
a) Using BlackBerry multimedia platform API
b) OpenAl API
By default, through native apps, it doesn't tie in with the NowPlayingConnection service and you won't see this behaviour.