Type Function Library media.* Return value none Revision Current Public Release (2017.3068) Keywords media, sound, event sound, audio See also audio.* media.newEventSound()
Plays an event sound (1-3 seconds). The first argument may be either an event sound ID or a filename for the event sound. This is recommended for short sounds, especially to avoid performance hiccups.
On iOS devices and the Xcode iOS Simulator, the only supported sound formats are
.aif. These formats must be uncompressed or they will not play.
On Android devices, the only supported sound formats are
The Corona Simulator supports
For Android devices, the sound should be preloaded with the media.newEventSound() API.
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.
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 )