Video
Video properties
| Property | Type | Default | Access | Description |
|---|---|---|---|---|
| autoplay | boolean | false | Read/Write | Whether the video plays automatically |
| currentTime | number | 0 | Read/Write | Current 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(*) | number | 1.0 | Read/Write | Default playback speed of the video; only takes effect when set before src; valid range is [0.1, 16] |
| duration | number | NaN | Read | Total video duration, in seconds (s); NaN if no video source is specified; Infinity for live streams |
| ended | boolean | false | Read | Whether playback has ended |
| error | object | null | Read | Returns an error information object for the most recent error |
| live | boolean | false | Read | Whether it is a live stream |
| loop | boolean | false | Read/Write | Whether the video plays in a loop |
| muted | bollean | false | Read/Write | Video mute state |
| obeyMuteSwitch | boolean | false | Read/Write | Whether the video obeys the system mute switch (iOS only) |
| paused | boolean | false | Read | Whether it is currently paused |
| playbackRate(*) | number | 1.0 | Read/Write | Playback speed of the video; only takes effect when set after src; valid range is [0.1, 16] |
| played | TimeRanges | null | Read | Time ranges of the video that have been played |
| instanceID | number | 0 | Read | Unique ID of the video player instance |
| preload | string | metadata | Read/Write | Video 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 |
| seeking | boolean | false | Read | Whether it is currently seeking |
| src | string | empty string | Read/Write | Video source |
| videoHeight | number | 0 | Read | Intrinsic height of the video |
| videoWidth | number | 0 | Read | Intrinsic width of the video |
| volume | number | 1 | Read/Write | Volume; valid range is [0.0, 1.0] |
Property details:
error: error holds the information of the most recent error, or null if there is no error
Object error properties
Property Type Description code number Error code message String Error description The valid values of error.code are listed in the table below
Name Value Description MEDIA_ERR_NONE 0 Normal MEDIA_ERR_ABORTED 1 Fetching the video content was aborted MEDIA_ERR_NETWORK 2 An error occurred during download MEDIA_ERR_DECODE 3 An error occurred during decoding MEDIA_ERR_SRC_NOT_SUPPORTED 4 The video's srcpoints to an unsupported resource typevideoHeight & 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
