Type Function Library media.* Return value none Revision 2018.3437 Keywords media, sound, event sound, audio See also media.newEventSound() media.playSound()
Because of various limitations outlined below, it is recommended that the audio library be used for playing back audio.
Plays an event sound
There is no volume control API for event sounds. It is intended for alert sounds and the volume is controlled by the device's hardware controls.
Supported audio formats vary
For Android devices, the sound should be preloaded with the media.newEventSound() API.
media.playEventSound( sound [, baseDir] [, completionListener] )
Constant. If specified, this argument is the directory where the sound file is located, if you specified a filename for
sound. The default is
system.ResourceDirectory. Other options include:
Function. If specified, a listener function that will be called each time the event sound is played. Note, however, that Android does not support this functionality.
local soundID = media.newEventSound( "beep.caf" ) local playBeep = function() media.playEventSound( soundID ) end timer.performWithDelay( 7500, playBeep, 0 )