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
Developer
Puzzling
Posts: 51
Registered: ‎10-22-2011
My Device: 9800

Sound playing twice on PB2

I have a WebWorks app that runs find under 1.0.7 and 1.0.8 but when I run it on 2.0, my keyclick sound plays twice when I execute the .play() method on the audio object.   I've checked my debug log and it is clearly only hitting the play call once.    I've worked around this problem by ensuring I clear the audio src on the "ended" event and set it immediately prior to calling play().   This works but seems possibly inefficient (I'm not sure where the sound data gets cached). 

 

Just wondering if anybody else is aware of this and knows of a better workaround.

Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Sound playing twice on PB2

Could it be looping?  From what you've described, successfully interrupting playback during the 'ended' event tells me that it is continung to do something after that event has happened.

 

Can you post a snippet of HTML + JavaScript that can reproduce this problem?  Want to verify this myself using your code.

 

If this behavior has changed between 1.0.8 and 2.0, it may in fact be a bug so we will log an issue once we can reproduce it.

 

Thanks!

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Developer
maribou
Posts: 40
Registered: ‎04-01-2009
My Device: Torch 9810

Re: Sound playing twice on PB2

[ Edited ]

I have the same issue with Tablet OS 2.1  Still trying to find a workaround.  Reloading audio in ended event listener works, but adds a noticeable lag.

 

The audio is not looping, it plays once the first time the sample is played.  Each subsequent play() call results in the first 250..500ms of the sample played first followed by the entire sample played immediately after.

 

Here is the sequence of events the audio object receives:

 

First time it is played:

play

waiting

loadstart

durationchange

loadedmetadata

loadeddata

canplay

canplaythrough

playing

durationchange

timeupdate (5 times)

pause

ended

progress

suspend

 

Here is the second play() call, when I hear the sound twice:

seeking

timeupdate

play

playing

seeked

timeupdate (5 times)

pause

ended

progress

suspend

 

The callbacks might be asynchronous, but this is the order they are logged in the console.