---
metadata:
  - name: generator
    content: Diplodoc Platform v5.34.3
alternate:
  - https://yandex.com/dev/video-sdk/doc/en/sdk-html5/AdPlaybackController-class.md
  - https://yandex.com/dev/video-sdk/doc/ru/sdk-html5/AdPlaybackController-class.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/video-sdk/doc/en/llms.txt

# AdPlaybackController

The object provides an API for controlling ad playback. It allows playing an ad once. To play the ad again, create a new AdPlaybackController instance.

[Methods](#methods)

## Methods {#methods}

#|
|| **Name** | **Type (Returned)** | **Description** ||
|| `getAdContentSize ()` | [PublicAdContentSize](https://yandex.com/dev/video-sdk/doc/en/sdk-html5/PublicAdContentSize.md) | Returns the current ad size. ||
|| `getAdPlayingState ()` | [PublicAdPlayingState](https://yandex.com/dev/video-sdk/doc/en/sdk-html5/PublicAdPlayingState.md) | Returns the current ad playback state. ||
|| `getAdSkippableState ()` | boolean | Shows if the creative can be skipped. ||
|| `pauseAd ()` | void | Pauses the ad. ||
|| `playAd ()` | void
|
Starts playing the ad.

{% note warning %}

The method can only be called once, all subsequent calls are ignored.

{% endnote %}||
|| `resumeAd ()` | void | Resumes playing the ad. ||
|| `skipAd ()` | void | Skips all ads at once (all AdPods). Before calling the method, the player needs to make sure the `getAdSkippableState` method returns `true`. ||
|| `stopAd ()` | void | Stops the ad. ||
||`subscribe` 
([`AdPlaybackControllerSubscribeMethod`](https://yandex.com/dev/video-sdk/doc/en/sdk-html5/AdPlaybackControllerSubscribeMethod-function.md))
|  
| Subscribes to an ad event.||
||`getAdVolume` | number | Returns the current volume in the range [0; 1]. The actual volume is only returned after calling the `playAd ()` method and before destroying the object. Returns `0` at any other time.||
||`setAdVolume` | void
|
Sets the volume in the range [0; 1]. Setting the volume is only available after the ad starts playing (the `playAd ()` method) and before it stops (the `AdStopped` event).

{% note alert %}

Setting it to a value different from zero may pause the video if no video element is activated. This is due to the browser auto play policies. We recommend only a user action turning on the volume.

{% endnote %}||
|| `getAdVolumeAvailabilityState` | boolean 
|
Status that shows if ad volume control is available. Acceptable values:
* `true` — Available;
* `false` — Not available.

The actual status is available immediately after calling the `playAd ()` method and before destroying the object. Returns `false` at any other time.

{% note info %}

The status is returned regardless of whether the volume controls are visible.

{% endnote %}||
|| `getAdPodTimeToSkip` |   | Returns the time until the ad creative can be skipped ||
|| `getAdRemainingTime ` |   | Returns the remaining playback time for the entire ad block. ||
|| `getAdPodRemainingTime ` |   | Returns the remaining playback time for the current ad creative. ||
|| `getAdDuration ` |   | Returns the duration of the entire ad block. ||
|| `getAdPodDuration ` |   | Returns the duration of the current ad creative. ||
|#
