<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVAudioPlayer/init(data:fileTypeHint:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioPlayer(im)initWithData:fileTypeHint:error:"
  },
  "title" : "init(data:fileTypeHint:)"
}
-->

# init(data:fileTypeHint:)

Creates a player to play in-memory audio data of a particular type.

```
init(data: Data, fileTypeHint utiString: String?) throws
```

## Parameters

`data`

A buffer with the audio data to play.

`utiString`

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

## Return Value

A new audio player instance, or <doc://com.apple.documentation/documentation/ObjectiveC/nil-227m0> if an error occurs.

## 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 <doc://com.apple.documentation/documentation/AVFoundation/AVFileType> for supported values.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)