sound¶
Playing sounds¶
-
class
sound.
AudioPlayer
(path: str)¶ A wrapper of the
AVAudioPlayer
class of the AVFoundation framework. Use this class for playing long sounds with the ability to pause, to stop and to set the time.-
current_time
¶ The current time of the sound in seconds.
Return type: float
-
pause
()¶ Pauses the audio.
-
play
()¶ Plays the audio asynchronously.
-
playing
¶ A boolean indicating whether the sound is playing. (read only)
Return type: bool
-
stop
()¶ Stops the audio.
-
volume
¶ The volume of the sound. (From 0 to 1)
Return type: float
-
-
sound.
play_file
(path: str)¶ Plays a file at given path.
Warning
Only use this function for sounds under 30 seconds. Use
AudioPlayer
for longer sounds.Parameters: path – The relative path of the file to play.
Playing system sounds¶
-
sound.
play_system_sound
(id: int)¶ Plays a system sound with given ID.
For a list of sounds: github.com/TUNER88/iOSSystemSoundsLibrary.
Parameters: id – The ID of the system sound to play.
-
sound.
play_beep
()¶ Plays a beep sound.