Instance Property

pan

The audio player’s stereo pan position.

Declaration

var pan: Float { get set }

Discussion

By setting this property you can position a sound in the stereo field. A value of –1.0 is full left, 0.0 is center, and 1.0 is full right.

See Also

Configuring and Controlling Playback

func play() -> Bool

Plays a sound asynchronously.

func play(atTime: TimeInterval) -> Bool

Plays a sound asynchronously, starting at a specified point in the audio output device’s timeline.

func pause()

Pauses playback; sound remains ready to resume playback from where it left off.

func stop()

Stops playback and undoes the setup needed for playback.

func prepareToPlay() -> Bool

Prepares the audio player for playback by preloading its buffers.

func setVolume(Float, fadeDuration: TimeInterval)

Fades to a new volume over a specific duration.

var isPlaying: Bool

A Boolean value that indicates whether the audio player is playing (true) or not (false).

var volume: Float

The playback volume for the audio player, ranging from 0.0 through 1.0 on a linear scale.

var rate: Float

The audio player’s playback rate.

var enableRate: Bool

A Boolean value that specifies whether playback rate adjustment is enabled for an audio player.

var numberOfLoops: Int

The number of times a sound will return to the beginning, upon reaching the end, to repeat playback.

var delegate: AVAudioPlayerDelegate?

The delegate object for the audio player.

protocol AVAudioPlayerDelegate

A protocol that allows a delegate to respond to audio interruptions and audio decoding errors, and to the completion of a sound’s playback.

var settings: [String : Any]

The audio player’s settings dictionary, containing information about the sound associated with the player.