Initializer

init(data:)

Initializes and returns an audio player for playing a designated memory buffer.

Declaration

init(data: Data) throws

Parameters

data

A block of data containing a sound to play. The audio data must be in a format supported by Core Audio.

outError

If an error occurs, upon return the NSError object describes the error. Set to NULL to ignore errors.

Return Value

On success, an initialized AVAudioPlayer object. If nil, the outError parameter contains an NSError instance describing the problem.

Discussion

See Also

Initializing an AVAudioPlayer Object

init(contentsOf: URL)

Initializes and returns an audio player for playing a designated sound file.

init(contentsOf: URL, fileTypeHint: String?)

Initializes and returns an audio player using the specified URL and file type hint.

init(data: Data, fileTypeHint: String?)

Initializes and returns an audio player using the specified data and file type hint.