Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Posts: 2
Registered: ‎02-23-2012
My Device: playbook
My Carrier: vodafone

Webworks Playbook - how can i play two sounds play simultaneously

playing a sound, other sound stops. How can I prevent it
Developer
Posts: 39
Registered: ‎03-01-2011
My Device: PlayBook
My Carrier: AT&T

Re: Webworks Playbook - how can i play two sounds play simultaneously

[ Edited ]

you may be using a single audio element that is over-writing itself when you call the second sound to be played.  i think you just need to create two different audio elements (if you're using the HTML5 audio)...

 

onload:

 

var firstSound = document.createElement('audio');

firstSound.setAttribute('src','sounds/sound1.wav');

firstSound.load;

 

var secondSound = document.createElement('audio');

secondSound.setAttribute('src','sounds/sound2.wav');

secondSound.load;

 

in your script:

 

firstSound.play();

secondSound.play();

 

both should play at the same time.

 

if that doesn't work or you need help with how to structure in your app, let me know.  i just tested it in my app and it worked with no issues.

New Member
Posts: 1
Registered: ‎04-15-2011
My Device: Blackberry Bold
My Carrier: Vodafone

Re: Webworks Playbook - how can i play two sounds play simultaneously

are sure about that? i create small test project but stop other song.
i'm using blackberry similator 1.0.8 /2.0 for mac vmware..
Developer
Posts: 39
Registered: ‎03-01-2011
My Device: PlayBook
My Carrier: AT&T

Re: Webworks Playbook - how can i play two sounds play simultaneously

good call @drony...  i just ran it through the firefox browser and it worked.  i am on the 2.2.0.5 sdk and the playbook hardware with 2.0 OS.  i will try the same test when i get home this afternoon and confirm or deny my outrageous (:smileyhappy:) claim.  i am pretty sure the actual playbook would play multiple sounds because i had that problem a few times when i only wanted it to play 1 at a time - but i will confirm later.

Developer
Posts: 39
Registered: ‎03-01-2011
My Device: PlayBook
My Carrier: AT&T

Re: Webworks Playbook - how can i play two sounds play simultaneously

correct - chrome will allow my two elements to play simultaneously, but the second sound overrides the first in the app.  i jumped the gun, but at least using the HTML5 audio element (unless i'm missing something), it doesn't look like it will allow 2 simultaneous sounds.

New Developer
Posts: 10
Registered: ‎02-26-2012
My Device: Z10, Bold 9700, Playbook 32 Gb
My Carrier: Telcel

Re: Webworks Playbook - how can i play two sounds play simultaneously

Any news about this topic? I've tried with soundjs but didn't worked when installed on playbook. Any tip would be very appreciated. 

 

 

New Contributor
Posts: 2
Registered: ‎02-23-2012
My Device: playbook
My Carrier: vodafone

Re: Webworks Playbook - how can i play two sounds play simultaneously

[ Edited ]

this is not possible mobile webkit engine.

All mobile browsers appear to have this limitation. They will only play 1 piece of media at a time through their HTML5 native audio/video.

This affect: iOS, Android, BB PlayBook.
https://groups.google.com/d/topic/jplayer/_r_nEIZuRtI/discussion

 

and apple dev source

https://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Vi...