---
title: "init(contentsOf:fileTypeHint:)"
framework: avfaudio
role: symbol
role_heading: Initializer
path: "avfaudio/avaudioplayer/init(contentsof:filetypehint:)"
---

# init(contentsOf:fileTypeHint:)

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

## Declaration

```swift
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

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

## Discussion

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

- [init(contentsOf:)](avfaudio/avaudioplayer/init(contentsof:).md)
- [init(data:)](avfaudio/avaudioplayer/init(data:).md)
- [init(data:fileTypeHint:)](avfaudio/avaudioplayer/init(data:filetypehint:).md)
