언어 설정

Menu
Sites
Language
Audio.play( ) causes app pause

(Posted as a bug here).

Whenever I call play on a sound file, it causes all execution to pause for a moment. The sound effect is preloaded, and I've even tried the old trick of doing play then pause upon loading, just to make sure everything's set up; to no avail.

Has anyone got any workarounds for this? The game runs nice and smooth at 60fps if I turn sound effects off, but it's unplayable with them on.

 

Thanks,

Mark

Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

3 댓글
Raghavendra Reddy Shiva
Seems to be performance issue. Are you testing on tizen device with hardware acceleration ? Have checked the below code for the audio playback and works fine without any "Pause". Play/Pause function AudioPlayPause() { var myAudio = document.getElementsByTagName('audio')[0]; if (myAudio.paused) myAudio.play(); else myAudio.pause(); } Are there any specific steps to be followed here ? Is this issue observed only, when rendering the graphics (for gaming) ? You can also use the "soundmanager2" API's to work with audio playback using javascript. Refer below link for more details. http://www.schillmania.com/projects/soundmanager2/
Mark Ripley
I'm using the 2.2 firmware, so yeah I think it's accelerated. Playing mp3's seems to produce less of a pause, but that might be because it doesn't actually play the sfx very often - probably due to it being only able to play one mp3 at a time? Thanks for the SM2 link, but I'm wary of introducing Flash into the mix, especially as I only want a few sfx to play properly :) Tried a few other things, like moving play() calls out of my box2d collision callback, lowering the framerate to 30, calling play() on load and let it play through, but nothing really improved. Setting the fps to 30 seemed to make matters worse, bizarrely. I've also noticed that it can sometimes take up to a second for a triggered sfx to actually play, too Anyway, thanks for your help :)
Mark Ripley
One more thing.... Looping sfx don't loop very well, there's a pause at the end of each loop - again, up to a second.