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
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Carrier: Sprint

Re: audio latency

*bump*

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Carrier: Sprint

Re: audio latency

*hears crickets chirp*

 

(also in the bug I created for this)

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
Regular Contributor
superfly_fr
Posts: 53
Registered: ‎12-23-2011
My Carrier: SFR

Re: audio latency

[ Edited ]

I'm experiencing the same issue with a WW (10.0.2.9)/BBui (0.9.4) HTML5 game.
I need to fire a (short / ogg) sound on touch events.

 

I did it the "simple way" in my main script :

var audioValid = new Audio('sounds/audioValid.ogg');

 And then in my touch event handler :

 

audioValid.play();

As my game is based on sequences that are running faster with levels, it works fine when time elapsed between events (touch) is long enough (> sound lenght ?), but won't play the sound when it is shorten (< sound length ?).

 

Is there any "good practice" or workaround for this ?

Please use plain text.
Contributor
gilber966
Posts: 27
Registered: ‎06-21-2013
My Carrier: tigo

Re: audio latency

[ Edited ]

 

function playSound(which){document.getElementById(which).play();}
function doSome(){ //your answer on touch event } //on touchStart playSound("some"); setTimeout("doSome()",timeRequired);

 

 

so I've solved it. But if I have a problem with endless sounds, to start again noticeable in playback, anyone know how to fix it?

Please use plain text.
Contributor
gilber966
Posts: 27
Registered: ‎06-21-2013
My Carrier: tigo

Re: audio latency

it is also possible to know whether a term to reproduce sound

http://buzz.jaysalvat.com/documentation/sound/
Please use plain text.
Regular Contributor
superfly_fr
Posts: 53
Registered: ‎12-23-2011
My Carrier: SFR

Re: audio latency

[ Edited ]

Thanks for that, I'll give it a try !

About my personal investigations and the thread topic;

I've noticed there's something wrong in the webkit: very short sounds (say < 1sec.) do not fire then end event properly (thus the random loop, I believe).

My personal workaroud have been to add 1 extra silent second and force position to zero.

gilber966 : how did you manage this in tour library ? (sorry no time for digging right now)

Please use plain text.
Contributor
gilber966
Posts: 27
Registered: ‎06-21-2013
My Carrier: tigo

Re: audio latency

buzz library?,if so, that's how I did it (to detect an audio is ended

 

var mySound = new buzz.sound("/sounds/mysound.ogg");
mySound.play();

 

 

and the game loop call this function:

 

function soundEnded(wich){
if(sounEnabled==false){return;}//I find that the sound is ON lol..
if(mySound.isEnded()){
     //do something after the reproduction
 }
}

 

 

 

Please use plain text.
Regular Contributor
superfly_fr
Posts: 53
Registered: ‎12-23-2011
My Carrier: SFR

Re: audio latency

I had problems with short sounds and "isEnded" event/state. It wasn't fired properly.

I have to dig again, I'm revamping my game from scratch and there might have been changes I'm not aware of in the APIs ...

Please use plain text.
Contributor
gilber966
Posts: 27
Registered: ‎06-21-2013
My Carrier: tigo

Re: audio latency

have downloaded the library and you placed in the head?


Please use plain text.
BlackBerry Development Advisor
twindsor
Posts: 741
Registered: ‎07-15-2008
My Carrier: Bell

Re: audio latency

The issues with Audio latency and cutting off the currently playing audio are due to the way that media playback is implemented using the standard media player. It's fine for videos and music files, but definitely not the right implementation for short clips and sound effects.

 

Until we get the Web Audio API implemented, the replacement is to use this PhoneGap/Cordova plugin that we released a little while ago: https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10-Cordova/LowLatencyAudio

Tim Windsor
Application Development Consultant
Please use plain text.