AudioPlayer

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.

property current_time: float

The current time of the sound in seconds.

Return type:

float

pause()

Pauses the audio.

play()

Plays the audio asynchronously.

property playing: bool

A boolean indicating whether the sound is playing. (read only)

Return type:

bool

stop()

Stops the audio.

property volume: float

The volume of the sound. (From 0 to 1)

Return type:

float