Contents

init(contentsOf:fileTypeHint:)

Creates a player to play audio from a file of a particular type.

Declaration

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

Parameters

  • url:

    A URL that identifies the local audio file to play.

  • utiString:

    The uniform type identifier (UTI) string of the file format.

Return Value

A new audio player instance, or nil if there is an error.

Discussion

The audio data must be in a format that Core Audio supports. Passing a file type hint helps the system parse the data if it can’t determine the file type or if the data is corrupt. See AVFileType for supported values.

See Also

Creating an audio player