> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pnplayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Controls & Events

> A guide on how events and tracking works inside the player.

## Prerequisites

* [Player Integration](./setup)

### Remote Control

Remote control methods allow you to programmatically control the video player, including play, pause, seek, and fullscreen actions.

<ParamField path="playerInstance.play()" type="function">
  Start or resume playback of the video
</ParamField>

<ParamField path="playerInstance.pause()" type="function">
  Pause the video playback
</ParamField>

<ParamField path="playerInstance.seek(time)" type="function">
  Jump to a specific time in the video (time in seconds)
</ParamField>

<ParamField path="playerInstance.fullscreen()" type="function">
  Toggle fullscreen mode on or off
</ParamField>

<ParamField path="playerInstance.destroy()" type="function">
  Destroy player instance and attached media element
</ParamField>

### Events

<ParamField path="playerInstance.on/off" type="function">
  You can attach or remove event listeners on the player instance using `.on(event, callback)` or `.off(event, callback)`
</ParamField>

<ParamField path="event" type="string">
  <Expandable title="possible events">
    <ParamField path="time" type="string">
      Fired periodically during playback with the current time
    </ParamField>

    <ParamField path="fullscreen" type="string">
      Fired when the player enters or exits fullscreen
    </ParamField>

    <ParamField path="ready" type="string">
      Fired when the player is ready
    </ParamField>

    <ParamField path="play" type="string">
      Fired when playback starts
    </ParamField>

    <ParamField path="pause" type="string">
      Fired when playback is paused
    </ParamField>

    <ParamField path="captionsChanged" type="string">
      Fired when the current captions/subtitles text track changes.
    </ParamField>

    <ParamField path="playlistItem" type="string">
      Fired when a new item in the playlist starts playing
    </ParamField>
  </Expandable>
</ParamField>

<ParamField path="callback" type="function">
  Function called when the event is triggered, receives event data as argument
</ParamField>

Example

```js theme={null}
playerInstance.on("time", function(data) => {
  console.log("time is ", data.currentTime)
});
```
