<!--
{
  "availability" : [
    "tvOS: 12.0.0 - 18.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "TVMLKit",
  "identifier" : "/documentation/TVMLKit/TVPlayer/dispatch(event:userInfo:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "TVMLKit"
    ],
    "preciseIdentifier" : "c:objc(cs)TVPlayer(im)dispatchEvent:userInfo:completion:"
  },
  "title" : "dispatch(event:userInfo:completion:)"
}
-->

# dispatch(event:userInfo:completion:)

Dispatches custom playback events to the JavaScript environment.

```
func dispatch(event: TVPlaybackEvent, userInfo: (any TVPlaybackEventMarshaling)?, completion: (@Sendable (Bool) -> Void)? = nil)
```

## Parameters

`event`

The custom playback event to be dispatched.

`userInfo`

The user information for the custom event.

`completion`

A block that is called after the event has been dispatched. Contains the information required to process the event’s results.

## Discussion

> Important:
> You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration:
> 
> ```swift
> func dispatch(event: TVPlaybackEvent, userInfo: (any TVPlaybackEventMarshaling)?) async -> Bool
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/calling-objective-c-apis-asynchronously>.

---

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)