Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Cloud Video
    • Overview
    • Control
    • Troubleshooting
      • Overview
      • IFrame
      • iOS
        • Getting started
        • Player initialization parameters
        • Player methods
        • Player state
        • Player events
  • Access management
  • Pricing policy
  • Audit Trails events
  • Release notes

In this article:

  • Video player parameters
  • Player state object
  1. Video Player
  2. SDK
  3. JavaScript
  4. Player state

Player state

Written by
Yandex Cloud
Updated at October 9, 2024
  • Video player parameters
  • Player state object

You can get information about the video player state and parameters using a special object which contains fields with state values.

Video player parametersVideo player parameters

Video types in the playerVideo types in the player

The video player supports three types of videos:

  • VOD: Standard video with a fixed beginning, end, and duration.

    An example of such a video is a movie.

  • EVENT: Live stream where only the beginning is fixed, and duration is constantly increasing as the right edge of the timeline keeps crawling forward.

    A user can rewind or fast forward to any point on the video timeline, from the beginning to what is now its right edge. If a user’s playback position matches the right edge, this user is considered to be online. At some point, the right edge may stop crawling, in which case the video type will change to VOD.

    An example of such a video is a soccer game live stream.

  • LIVE: Live stream where the right and left edges of its timeline continiously change over time.

    A user can only rewind or fast forward between the current left and right timeline edges. As with EVENT videos, if a user’s playback position matches the right timeline edge, this user is considered to be online.

    An example of such a video is a live stream of a TV channel.

The video type is specified in the videoType field of the object with player states.

Current timeCurrent time

Current time marks the current playback position on the timeline. You can get the current time from the currentTime field of the object with player states.

Current time is measured in seconds.

LIVE videos use Unix timestamps. For the VOD and EVENT types, it is measured in seconds from the start of the video, which has the 0 value.

Example 1: For VOD and EVENT video types, currentTime may indicate 10. This means that the current playback position on the timeline is 10 seconds from the start of the video.

Example 2: For a LIVE video, the currentTime field may indicate 1600000000. This means that the current playback position on the timeline matches new Date(1600000000 * 1000) in absolute time, i.e., Sep 13 2020 14:26:40 GMT+0200.

DurationDuration

Duration indicates the difference between the right and left edges of the video timeline. You can get the video duration from the duration field of the object with player states.

Duration is measured in seconds.

For the LIVE video type, duration is always Infinity.

Video start time in UTC .Video start time in UTC .

Video start time in UTC indicates the start time of a live stream in UTC format. You can get this value from the utcStartTime field of the object with player states.

Video start time is measured in seconds.

For LIVE videos, the value is always 0.

For the EVENT video type, it is always a non-null value in Unix Timestamp format.

Example: The utcStartTime field may indicate 1600000000. This means the video started at new Date(1600000000 * 1000), or Sep 13 2020 14:26:40 GMT+0200.

For VOD videos, this is an optional value. For example, a VOD video may get this value if it was created from an EVENT video. The value is undefined when it is not specified. If specified, the value is in utcStartTime format (same as for EVENT).

Seekable rangeSeekable range

Seekable range indicates the timeline range where the user can move the current playback position. You can get this value from the seekableRange field of the object with player states.

Format:

{
    /** @type {number} left edge of the range in seconds */
    start,
    /** @type {number} right edge of the range in seconds */
    end,
}

For VOD and EVENT videos, the start field is always set to 0. The end field value matches the right edge of the timeline. In the case of EVENT videos, this value is constantly increasing.

For the LIVE type, the start and end values are specified in Unix Timestamp format. The end value is constantly increasing.

For example, if the seekableRange field of a LIVE broadcast contains an object with the start === 1600000000 and end === 1600001000 fields, the user’s seekable range has 1600000000 and 1600001000 as its left and right edges.

Playback status .Playback status .

You can get the playback status value from the status field of the object with player states.

The playback status may take one of the following values:

  • idle: Player is waiting for content to play.
  • init: Initializing the player after the first playable content is set.
  • buffering: Player is in buffering state and cannot play the video, e.g., due to lack of data.
  • play: Video playback is in progress.
  • pause: Player is paused.
  • end: Current video playback ended at the right edge of the timeline.
  • fatal: Current video cannot be played; the user gets an error screen. To start a video, the user can try switching to other content.
  • broken: Player is broken and cannot play the video, the user gets an error screen. Switching to other content is not possible.
  • destroyed: destroy method was called, the player is destroyed and can no longer play the video.
  • cancelled: Live stream was cancelled.
  • preparing: Live stream is about to start.
  • finished: Live stream ended.

Player state objectPlayer state object

A player state is an object with the following fields:

  • source
  • status
  • error
  • currentTime
  • duration
  • videoType
  • muted
  • volume
  • utcStartTime
  • seekableRange
  • bufferedRanges.

sourcesource

Link to current content. If no content is provided, the source field is set to undefined.

statusstatus

Playback status.

It can take the following values:

  • 'idle'
  • 'init'
  • 'buffering'
  • 'play'
  • 'pause'
  • 'end'
  • 'fatal'
  • 'broken'
  • 'destroyed'
  • 'cancelled'
  • 'preparing'
  • 'finished'

The default value is 'idle'.

errorerror

Player error.

If there are no errors at the moment, this field is undefined. In case of an error, its value is an object of the following format:

{
    /** @type {string} error code */
    code,
    /** @type {string} error message */
    message,
}

If the field contains an error object, this means, at the moment, the player cannot start or resume video playback. In this case, the status field value will be either 'fatal' or 'broken'.

The default value is undefined.

currentTimecurrentTime

Current time (timeline position) in seconds.

The default value is NaN.

durationduration

Video duration in seconds.

The default value is NaN.

videoTypevideoType

Video type.

It can take the following values:

  • undefined
  • 'VOD'
  • 'EVENT'
  • 'LIVE'

The default value is undefined.

mutedmuted

Video muted status. If true, sound is off; if false, sound is on.

The default value is the one provided in the configuration on player initialization. If no value was provided on initialization, the default value is true.

volumevolume

Video volume level ranging from 0 (muted) to 1 (maximum volume).

The default value is the one provided in the configuration on player initialization. If no value was provided on initialization, the default value is 1.

utcStartTimeutcStartTime

Video start time in UTC specified in seconds or undefined.

The default value is undefined.

seekableRangeseekableRange

Seekable range.

The default value is { start: NaN, end: NaN }.

bufferedRangesbufferedRanges

Buffered ranges. This is an array of objects in the following format:

{
    /** @type {number} buffer start in seconds */
    start,
    /** @type {number} buffer end in seconds */
    end,
}

Array elements define the timeline ranges for which there is buffered data for playback.

The default value is an empty array ([]).

See alsoSee also

  • Interface: PlayerSdkState in the API reference

Was the article helpful?

Previous
Player methods
Next
Player events
Yandex project
© 2025 Yandex.Cloud LLC