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 audio in the background
This function does not block script execution. Audio playback stops when the script ends. If you need full playback, add a delay before exiting.

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