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
Contributor
Payso
Posts: 12
Registered: ‎06-04-2013
My Device: Z10
My Carrier: Vodafone
Accepted Solution

HTML5 audio simply is not working

[ Edited ]

HI,

 

I have some html5 audio elements placed directly on the markup on the page.

 

I then trigger these with js to play at certain points in the app.

 

In all other devices/browsers this is working fine.  In BB10 WebWorks this is not.  It is proving a major stumbling block for delivery on my project.

 

This is my audio player:

 

		<audio id="genCorrect" preload="auto">
			<source src="audio/generic-correct.wav" type="audio/wav"></source>
			<source src="audio/generic-correct.mp3" type="audio/mpeg"></source>
			<p>Your browser does not support the audio element</p>
		</audio>

 And this is the code i use to trigger it:

 

document.getElementById('genCorrect').play();

 No sound is playing at all.

 

My model is Z10

 

Software release is 10.1.0.273

 

Any help would be greatfully received!

Please use plain text.
BlackBerry Development Advisor
anzor_b
Posts: 164
Registered: ‎09-24-2012
My Device: White BlackBerry 10
My Carrier: Bell

Re: HTML5 audio simply is not working

Hi Payso,

 

I've tried your sample code on the same device/software and the sound is playing for me, so let's see what else it could be:

 

1. After triggering play(), hit the volume up and down buttons, the now playing dialog should appear, and show the name of the audio file, as well as a play or pause button. If you see the pause button, it indicates that the audio file is playing. What do you see in the now playing dialog after triggering play()?

2. If you copy the file to the device, are you able to play it using the File Manager/Music apps?

3. Is the file local or remote to the WebWorks app?

4. Have you tried other audio files?

 

If you have a web server (xampp,wamp), try hosting the web page and pointing your BlackBerry 10 Browser to the page and test.

 

Please use plain text.
Contributor
Payso
Posts: 12
Registered: ‎06-04-2013
My Device: Z10
My Carrier: Vodafone

Re: HTML5 audio simply is not working

[ Edited ]

Hi,

 

After a night's sleep and a fresh pair of eyes it seems there is an issue with two of the sounds.

 

One does not load and one appears to load but cannot play.

 

If i set all triggers to the same sound it is fine so will accept that the issue is not with WebWorks but the content i have been supplied with.

 

All that aside your response was extremely useful as it gave me some debugging ideas that i missed yesterday so thanks.

 

Is there any preferential bitrate, codec for mp3 for BB10?

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,556
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: HTML5 audio simply is not working

You can find information about supported / preferred media formats here:

https://developer.blackberry.com/devzone/develop/supported_media/bb10_media_support.html


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.