In my app, upon touch events I play various short audio files using the media.playEventSound API.
I want to call a particular function once one of these audio files is done playing. Is there a way to do this? I didn't see an "IsPlaying" or similar method. If this can't be done with media.playEventSound, does the audio API allow this?
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
How to Determine Whether Audio File Has Completed Playing?
The openAL audio library does allow for this and is more advanced and flexible than the eventSound api.
I would suggest using the openAL audio api :)
http://developer.anscamobile.com/reference/index/audioischannelplaying
Danny, could you tell what's the name for event listener? I want to listen for event.completed, but can't find this in the docs.
http://developer.anscamobile.com/reference/index/audioplay
You can use the last parameter "onComplete =" to execute a function upon the sound completing playing.
eg
1 2 3 4 5 | local function doWhenPlaybackComplete(event) print("Audio playback finished") end audio.play(myAudio, {loops = 1, onComplete = doWhenPlaybackComplete}) |
Oh, I missed that. Thanks a lot!
views:1641 update:2011/10/11 8:57:46
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
corona forums © 2003-2011