How Yandex indexes sites
A site on search results page

Sending data about video status

Information about video status helps to improve video playback quality on Yandex.Video. For example, the time when a clip was started or paused, when the user jumped forward or back, etc. It's also important for us to get error reports when something goes wrong during playback.

Use the postMessage mechanism to send data about video status. For every event concerning the player (such as when the clip begins playing), call the window.parent.postMessage function in JavaScript. Pass the event name parameter to this function, as well as any additional parameters (for example, progress bar position).

    event: <Event name>,
    time: <Progress bar position in seconds>,
    code: <Error code>,
}, '*');

Note. Please note that you need to call the postMessage function for the parent object window.parent. This is because videos watched on Yandex are displayed in a separate frame (the iframe element) rather than on the main service page.

You need to send information that our robot can interpret so that we can analyze your video information. The table below lists events that are processed by the robot, as well as parameters that need to be passed in.

EventDescriptionEvent parameters

Player initialization.


Start of playback.

  • time — progress bar position in seconds.

    If the time parameter is not entered, then its value is 0 by default.


Stop playback.

  • time — progress bar position in seconds.


Viewing of clip completed (reached end of clip).

  • time — progress bar position in seconds.


Playback error.

  • time — progress bar position in seconds.

  • code — error code.



  • autoplay=1 — the video starts playing automatically

  • autoplay=0 (or no parameter is present) — the video does not start playing

<iframe src="//www.your-videohosting.com/video?autoplay=1"></iframe>
Note. You don't have to enter the player address with the autoplay parameter in the markup; it's enough for the player to support this parameter in searches.

Resume playback.

Note. Can be replaced with event started.

  • time — progress bar position in seconds.


Jump back in video

Note. Can be replaced with event started.

  • time — progress bar position in seconds.

  • previousTime — previous progress bar position in seconds.


Start of ad display.

  • time — progress bar position in seconds.

An example of data transfer at the moment when the video is launched is given below. When a user clicks Play on the player, it calls the handler function videoStart. This function in turn calls the window.parent.postMessage function with the necessary parameters.

// This function is called when the user clicks Play on the player  .
function videoStart() {
    // Sending message.
        event: 'started'
        // The "time" parameter can also be passed in.
        // If the "time" parameter is not entered,
        // then it takes the value 0 by default.
    }, '*');

Error notifications

The player should send the following error codes to the window.parent.postMessage function so that we are informed of problems that occur:

Error codeDescription
Video unavailable
101Video deleted.
102The videoclip or account has been blocked.
103The videoclip doesn't exist or the URL is not supported.
100Other situations where video is inaccessible.
Restricted access to videoclip
151Insufficient video viewing rights.
152Not permitted to play video on other sites.
153Not permitted to play video in given region.
154Restricted access that requires user confirmation (for example, due to age restriction).
150Other video viewing restrictions.
5Player malfunction (error in HTML-player function, etc.).
0Misc. errors.
function videoError(time, code) {
    // ...
        event: 'error',
        time: '62',
        code: '101'
    }, '*');
Rate this article
Thank you for your feedback!