<!--
{
  "availability" : [
    "tvOS: 12.0.0 - 18.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "TVMLKit",
  "identifier" : "/documentation/TVMLKit/TVPlayer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "TVMLKit"
    ],
    "preciseIdentifier" : "c:objc(cs)TVPlayer"
  },
  "title" : "TVPlayer"
}
-->

# TVPlayer

A customizable native media player used to control playback from the JavaScript player used in an Apple TV client-server app.

```
class TVPlayer
```

## Overview

You create a new `TVPlayer` object using your custom <doc://com.apple.documentation/documentation/AVFoundation/AVPlayer> object. You can then play media items that are associated with the JavaScript media player using the new player. For example, you can add gestures, overlays, and other custom features to your TV player.

## Topics

### Setting Up the Player

[`init(player:)`](/documentation/TVMLKit/TVPlayer/init(player:))

Creates a new customizable player from an existing player.

[`player`](/documentation/TVMLKit/TVPlayer/player)

The customizable media player.

[`playlist`](/documentation/TVMLKit/TVPlayer/playlist)

The playlist for the media player.

### Controlling Playback

[`next()`](/documentation/TVMLKit/TVPlayer/next())

Plays the next media item in the playlist.

[`pause()`](/documentation/TVMLKit/TVPlayer/pause())

Pauses the currently playing item.

[`previous()`](/documentation/TVMLKit/TVPlayer/previous())

Plays the previous media item in the playlist.

[`state`](/documentation/TVMLKit/TVPlayer/state)

The current state of the player.

[`TVPlaybackState`](/documentation/TVMLKit/TVPlaybackState)

The possible states of a player.

[`dispatch(event:userInfo:completion:)`](/documentation/TVMLKit/TVPlayer/dispatch(event:userInfo:completion:))

Dispatches custom playback events to the JavaScript environment.

[`TVPlaybackEvent`](/documentation/TVMLKit/TVPlaybackEvent)

Extend this structure to send your custom playback events to the JavaScript environment.

[`TVPlaybackEventMarshaling`](/documentation/TVMLKit/TVPlaybackEventMarshaling)

A protocol used for sending and receiving information across the JavaScript bridge.

[`TVPlaybackCustomEventUserInfo`](/documentation/TVMLKit/TVPlaybackCustomEventUserInfo)

The user information used in a custom playback event.

### Inspecting Media Items

[`setCurrentMediaItem(toItemAtIndex:)`](/documentation/TVMLKit/TVPlayer/setCurrentMediaItem(toItemAtIndex:))

Sets the current media item to the designated media item.

[`previousMediaItem`](/documentation/TVMLKit/TVPlayer/previousMediaItem)

The previously selected media item.

[`currentMediaItem`](/documentation/TVMLKit/TVPlayer/currentMediaItem)

The currently selected media item.

[`nextMediaItem`](/documentation/TVMLKit/TVPlayer/nextMediaItem)

The next media item in the playlist.

### Instance Methods

[`present(animated:)`](/documentation/TVMLKit/TVPlayer/present(animated:))



---

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)