Initializer

init(contentsOf:fileTypeHint:)

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

Declaration

init(contentsOf url: URL, fileTypeHint utiString: String?) throws

Parameters

url

A URL identifying the sound file to play. The audio data must be in a format supported by Core Audio.

utiString

A UTI that is used as a file type hint. The supported UTIs are defined in File Format UTIs.

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

The utiString file type hint tells the parser what kind of sound data to expect so that files which are not self identifying, or possibly even corrupt, can be successfully parsed.

See Also

Initializing an AVAudioPlayer Object

init(contentsOf: URL)

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

init(data: Data)

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

init(data: Data, fileTypeHint: String?)

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