<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVMusicUserEvent",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVMusicUserEvent"
  },
  "title" : "AVMusicUserEvent"
}
-->

# AVMusicUserEvent

An object that represents a custom user message.

```
class AVMusicUserEvent
```

## Overview

When playback of an [`AVMusicTrack`](/documentation/AVFAudio/AVMusicTrack) reaches this event, the system calls the track’s callback. You can’t modify the size and contents of an [`AVMusicUserEvent`](/documentation/AVFAudio/AVMusicUserEvent) once you create it.

## Topics

### Creating a User Event

[`init(data:)`](/documentation/AVFAudio/AVMusicUserEvent/init(data:))

Creates a user event with the data you specify.

### Inspecting a User Event

[`sizeInBytes`](/documentation/AVFAudio/AVMusicUserEvent/sizeInBytes)

The size of the data that the user event represents.



---

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)