Skip to main content

Play sound in background (device.play_sound)

Declaration

device.play_sound(path)

Parameters

  • path
    String. Absolute path to audio file. Supports mp3, wav, aac

Description

Play a piece of audio in background
This function does not block script execution; audio started by the script will stop when the script stops. If you need full playback, add delay before exit

Example

device.play_sound("/var/mobile/ten-years.mp3")
sys.msleep(205 * 1000) -- wait 205 seconds (3m25s)

Note: Uses function outside this chapter sys.msleep