[Yandex Cloud documentation](../../../index.md) > [Yandex Cloud Video](../../index.md) > Video Player > [SDK](../index.md) > [JavaScript](index.md) > Player events

# Player events

Using the [on and once](player-methods.md#subscribe-methods) methods of the JavaScript SDK, you can subscribe to [Cloud Video Player](../../concepts/player.md) events:

#### SourceChange {#sourcechange}

Switching content.

The handler in the `{ source }` object receives a new [content link](player-state.md#state-source).

Here is an example:

```javascript
player.on('SourceChange', ({ source }) => {
    console.log(source);
});
```

#### StatusChange {#statuschange}

Changing the [playback status](player-state.md#state-status).

The handler in the `{ status }` object receives a new playback status value.

Here is an example:

```javascript
player.on('StatusChange', ({ status }) => {
    console.log(status);
});
```

#### ErrorChange {#errorchange}

Getting or resetting an error.

The handler in the `{ error }` object receives an [error](player-state.md#state-error).

An error is reset when switching content (if switching content is possible). In this case, the handler receives the `error` object with the `undefined` value.

Here is an example:

```javascript
player.on('ErrorChange', ({ error }) => {
    console.log(error);
});
```

#### CurrentTimeChange {#currenttimechange}

Changing the position on the timeline.

The handler in the `{ currentTime }` object receives a new [current time](player-state.md#state-currentTime) value.

Here is an example:
```javascript
player.on('CurrentTimeChange', ({ currentTime }) => {
    console.log(currentTime);
});
```

#### DurationChange {#durationchange}

Changing the video duration.

The handler in the `{ duration }` object receives a new [duration](player-state.md#state-duration) value.

This event may occur:
* When you change content.
* Periodically for the `EVENT` [type](player-state.md#video-type-desc) videos as their duration continuously increases.
* When the `LIVE` video type changes to `VOD`.

Here is an example:
```javascript
player.on('DurationChange', ({ duration }) => {
    console.log(duration);
});
```

#### VideoTypeChange {#videotypechange}

Changing the video type.

The handler in the `{ videoType }` object receives a new [video type](player-state.md#state-videoType) value.

This event may occur:
* When you change content.
* When the `LIVE` or `EVENT` video type changes to `VOD`.

Here is an example:
```javascript
player.on('VideoTypeChange', ({ videoType }) => {
    console.log(videoType);
});
```

#### MutedChange {#mutedchange}

Changing the video `muted` status.

The handler in the `{ muted }` object receives a new [muted](player-state.md#state-muted) status value.

Here is an example:

```javascript
player.on('MutedChange', ({ muted }) => {
    console.log(muted);
});
```

#### VolumeChange {#volumechange}

Changing the video sound volume.

The handler in the `{ volume }` object receives a new [volume level](player-state.md#state-volume) value.

Here is an example:
```javascript
player.on('VolumeChange', ({ volume }) => {
    console.log(volume);
});
```

#### PlaybackSpeedChange {#playbackspeedchange}

Changing playback speed.

The handler in the `{ playbackSpeed }` object receives a new [playback speed](player-state.md#state-playbackSpeed) value.

Here is an example:
```javascript
player.on('PlaybackSpeedChange', ({ playbackSpeed }) => {
    console.log(playbackSpeed);
});
```

#### UtcStartTimeChange {#utcstarttimechange}

Changing the UTC video start time.

The handler in the `{ utcStartTime }` object receives a new [UTC time](player-state.md#state-utcStartTime) value.

This event may occur:
* When you change content.
* When the `LIVE` video type changes to `VOD`.

Here is an example:

```javascript
player.on('UtcStartTimeChange', ({ utcStartTime }) => {
    console.log(utcStartTime);
});
```

#### SeekableRangeChange {#seekablerangechange}

Changing the seekable range.

The handler in the `{ seekableRange }` object receives a new [seekable range](player-state.md#state-seekableRange) value.

This event may occur:
* When you change content.
* Periodically for the `LIVE` and `EVENT` type videos as their seekable range continuously increases.

Here is an example:

```javascript
player.on('SeekableRangeChange', ({ seekableRange }) => {
    console.log(seekableRange.start, seekableRange.end);
});
```

#### BufferedRangesChange {#bufferedrangeschange}

Changing the buffered ranges.

The handler in the `{ bufferedRanges }` object receives an array with a new description of [buffered ranges](player-state.md#state-bufferedRanges).

Here is an example:

```javascript
player.on('BufferedRangesChange', ({ bufferedRanges }) => {
    console.log(bufferedRanges);
});
```

#### FullscreenStateChange {#fullscreenstatechange}

Changing the fullscreen mode state.

The handler receives the `{ isFullscreen }` object containing the updated [fullscreen state](player-state.md#state-isFullscreen) value.

Here is an example:
```javascript
player.on('FullscreenStateChange', ({ isFullscreen }) => {
    console.log(isFullscreen);
});
```

#### TextTracksChange {#texttrackschange}

Updating the list of available text tracks (captions).

The handler receives the `{ textTracks }` object containing the new array of [available tracks](player-state.md#state-textTracks).

Here is an example:

```javascript
player.on('TextTracksChange', ({ textTracks }) => {
    console.log(textTracks);
});
```

#### Useful links {#see-also}

* [Interface: PlayerSdkEventHandlers](../../api-ref/javascript/interfaces/PlayerSdkEventHandlers.md) in the API reference