Seek Events

These API calls are used to retrieve and update the current media playback position.


.on('absolutePositionReady')

Fired when .getAbsolutePosition() is ready to return data.

{
  "ready": true
  "startDateTime": 1702321975350,
  "type": "absolutePositionReady"
}
Property Description
ready boolean Indicates whether .getAbsolutePosition() is (true) or is not (false) prepared to return absolute position data
startDateTime string Exposes the original broadcast date and time of the stream (in msec)

πŸ“˜

The following are used to determine startDateTime:

  • #EXT-X-PROGRAM-DATE-TIME in HLS
  • presentationTimeOffset in DASH
type stringIdentifies the event being listened for (absolutePositionReady)


.on('seek')

Fired when a seek has been requested either by scrubbing the control bar or through the API.

{  
  "position": 6.768026,  
  "offset": 7.860885148195877,  
  "duration": 118,  
  "currentTime": 6.768026,  
  "seekRange": {  
    "start": 0,  
    "end": 118  
  },  
  "metadata": {  
    "currentTime": 6.768026  
  },  
  "type": "seek"  
}
Property Description
currentTime 8.19.0+ number Position of the stream before the player seeks (in seconds)
duration 8.19.0+ number Duration of the current playlist item (in seconds)
position number Position of the player before it seeks (in seconds)
seekRange 8.19.0+ object Time range representing how much video is available for seeking in DVR streams or for buffering in live streams

See seek.seekRange
offset number The position that has been requested for seeking (in seconds)
metadata object Mutable properties defining the resource

See: seek.metadata
type string Identifies the listened-for event (seek)

seek.seekRange

Property Description
end number End time of the range relative to the currentTime of the stream (in seconds)
start number Start time of the range relative to the currentTime of the stream (in seconds)

seek.metadata

Property Description
currentTime 8.19.0+ number Position of the stream before the player seeks (in seconds)

πŸ“˜

Seeking is often based on keyframe availability. The actual position the player will eventually seek to may differ from what was specified.



.on('seeked')

Fired when video position changes after seeking, as opposed to on('seek') which triggers as a seek occurs.

{  
  "type": "seeked"  
}
Property Description
type string Identifies the listened-for event (seeked)


.on('time')

Fired when the playback position updates as the player is playing. This may occur as frequently as 10 times per second.

{  
    "position": 20.523624,  
    "duration": 231.509002,  
    "currentTime": 20.523624,  
    "seekRange": {  
        "start": 0,  
        "end": 231.509002  
    },  
    "metadata": {  
        "currentTime": 20.523624  
    },  
    "absolutePosition": null,  
    "type": "time",  
    "viewable": 1  
}
Property Description
absolutePosition Viewer's absolute position for a media file, which is the sum of the video’s current time and the stream's startDateTime value (in date format)
currentTimeΒ 8.19.0+Β number The position of the stream before the player seeks (in seconds)
duration 8.19.0+ number Duration of the current playlist item (in seconds)
metadata object Mutable properties defining the resource

See: time.metadata
position number Playback position (in seconds)
seekRange 8.19.0+ object Time range representing how much video is available for seeking in DVR streams or for buffering in live streams

See time.seekRange
type string Identifies the listened-for event (time)
viewable boolean If the player is 1 or is not 0 viewable

time.seekRange

Property Description
end number End time of the range relative to the currentTime of the stream (in seconds)
start number Start time of the range relative to the currentTime of the stream (in seconds)

time.metadata

Property Description
currentTime 8.19.0+ number Position of the stream before the player seeks (in seconds)

© 2007-2024 Longtail Ad Solutions, Inc.