Skip to content

Video ​

Video properties

PropertyTypeDefaultAccessDescription
autoplaybooleanfalseRead/WriteWhether the video plays automatically
currentTimenumber0Read/WriteCurrent playback position of the video, in seconds (s); valid range is [0, duration]; 0 if there is no video source; for live streams, video seeking cannot be performed by setting this property
defaultPlaybackRate(*)number1.0Read/WriteDefault playback speed of the video; only takes effect when set before src; valid range is [0.1, 16]
durationnumberNaNReadTotal video duration, in seconds (s); NaN if no video source is specified; Infinity for live streams
endedbooleanfalseReadWhether playback has ended
errorobjectnullReadReturns an error information object for the most recent error
livebooleanfalseReadWhether it is a live stream
loopbooleanfalseRead/WriteWhether the video plays in a loop
mutedbolleanfalseRead/WriteVideo mute state
obeyMuteSwitchbooleanfalseRead/WriteWhether the video obeys the system mute switch (iOS only)
pausedbooleanfalseReadWhether it is currently paused
playbackRate(*)number1.0Read/WritePlayback speed of the video; only takes effect when set after src; valid range is [0.1, 16]
playedTimeRangesnullReadTime ranges of the video that have been played
instanceIDnumber0ReadUnique ID of the video player instance
preloadstringmetadataRead/WriteVideo preload strategy; valid values are (1) "none": preload nothing (2) "metadata": stop loading once enough content is loaded to parse the metadata (3) "auto": load as much content as possible (4) empty string "": synonym for "auto". Note: (1) when preload == none, src is not validated (2) when preload == none, non-custom cover images are not loaded
seekingbooleanfalseReadWhether it is currently seeking
srcstringempty stringRead/WriteVideo source
videoHeightnumber0ReadIntrinsic height of the video
videoWidthnumber0ReadIntrinsic width of the video
volumenumber1Read/WriteVolume; valid range is [0.0, 1.0]

Property details:

  1. error: error holds the information of the most recent error, or null if there is no error

    Object error properties

    PropertyTypeDescription
    codenumberError code
    messageStringError description

    The valid values of error.code are listed in the table below

    NameValueDescription
    MEDIA_ERR_NONE0Normal
    MEDIA_ERR_ABORTED1Fetching the video content was aborted
    MEDIA_ERR_NETWORK2An error occurred during download
    MEDIA_ERR_DECODE3An error occurred during decoding
    MEDIA_ERR_SRC_NOT_SUPPORTED4The video's src points to an unsupported resource type
  2. videoHeight & videoWidth: the intrinsic dimensions of the video, in pixels

    (1) When a cover image is displayed, videoHeight and videoWidth are the width and height of the cover image

    (2) When video content is displayed, videoHeight and videoWidth are the width and height of the video content

    After the loadedmetadata event, if either videoHeight or videoWidth changes, a resize event is triggered