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

Posts: 16
Registered: ‎10-18-2010
My Device: Not Specified

Getting audio to loop

Some great people here have helped me through some of my troubles with using the API and javascript (total newbie with that stuff) so thank you, and I'm back.


var playerInstance = new  blackberry.audio.Player("local:///../sounds/dice_start.mp3","audio/mpeg", true); playerInstance.loop = true;

 The sound plays just fine, but I'm not getting it to loop. 


As always any help is very much appreciated. 

Posts: 10
Registered: ‎06-08-2011
My Device: Playbook
My Carrier: Vodafone

Re: Getting audio to loop

I have the same problem.


I tried the code below on a real Playbook device and it is playing only once. Chrome browser loops as expected.

The function is listening for the end event and resets the sound to the start point.


<meta name="viewport" id="viewport" content="initial-scale=1.0,user-scalable=no" />
<title>Local HTML5 Audio and Video Page</title>


<p>Using HTML5 audio element with embedded content:</p>

<audio id="audio_2" autoplay="autoplay">
   <source src="res/MySound.mp3" />
   Your browser does not support the <code>Audio</code> element
<script type="text/javascript">
document.getElementById('audio_2').addEventListener('ended', function(){ this.currentTime = 0; }, false);




The problem is that RIM wants us to develop for their devices but simple things like audio loop do not work.

And even worse there aren't many in-house developers on this forum to come up with answers.


So guys do you have any solution?