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
jacarma
Posts: 5
Registered: ‎03-26-2011
My Device: playbook
My Carrier: none
Accepted Solution

HTML5 Audio > Always on loop mode

I'm using this code to play some sounds on the playbook simulator (SDK 2.0)

 

var paintAudio=new Audio("arpa3.mp3");

paintAudio.play();

 

The audio plays but in loop mode (automatically starts playing again when it finishes).

 

Do you know how to override this behaviour?

 

Additionally, when I play a sound while another sound was playing, the first sound stops. Is only possible to run one sound at a time?

 

Thank you.

Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: HTML5 Audio > Always on loop mode

the audio element has a "loop" property that you can change from true to false:

 

 

paintAudio.loop = false;

 

 

I know when you define an <audio> HTML element, the default value for this property is false.  I'm surprised to see that when creating a similar DOM element using pure JavaScript, that the default value appears to be true.  Does this seem like a defect to you, or is using the above setting acceptable?

 

Regarding your second question about syncronization, are you running your content on a simulator or live device?  The simulator is not able to reproduce the multi-threaded behavior of the live PlayBook device - so you get one event stopping and the other starting.

 

Cheers,

Adam

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
New Contributor
jacarma
Posts: 5
Registered: ‎03-26-2011
My Device: playbook
My Carrier: none

Re: HTML5 Audio > Always on loop mode

The loop behaviour is not the same in iPhone and Android, I think it should be modified.

 

I'm testing on the simulator, don't have a device yet.

 

Thank you

Please use plain text.
Contributor
JamesAllen
Posts: 25
Registered: ‎03-31-2011
My Device: Playbook
My Carrier: N/A

Re: HTML5 Audio > Always on loop mode

Hi Jacarma,

I had this exact issue in the simulator but tested my app on the actual hardware that arrived today and it does not loop - just plays once.
Please use plain text.
New Developer
warodri
Posts: 7
Registered: ‎11-13-2009
My Device: Not Specified

Re: HTML5 Audio > Always on loop mode

I could emulate multiple audio files at the time with: http://rippledocs.tinyhippos.com/index.html

 

 

Please use plain text.
poc
Contributor
poc
Posts: 13
Registered: ‎09-18-2011
My Device: Z10 LE
My Carrier: Movistar

Re: HTML5 Audio > Always on loop mode

I've not multithread behavior playing sound in my PB

My HTML5 app plays sound in loop mode and another sounds at he same time when i testing in mi PC with my chrome browser, but when i deploy to my PB, the loop sound stops when another sound begin playing

Why?

Thanks in advance

 

Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: HTML5 Audio > Always on loop mode

Its because PlayBook currently only supports 1 active channel for HTML5 audio, while Chrome has a different implementation.

 

The latest PlayBook Tablet OS v2.1 developer BETA has this feature improved. If you upgrade your device, you will see that you can play multiple audio streams on the same page:

http://devblog.blackberry.com/2012/05/blackberry-playbook-2-1-0-beta/

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.