sud.createVideo
JS
Video sud.createVideo(Object object)Creates a video object.
Parameters
Object object
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| x | number | 0 | No | The x-coordinate of the video's top-left corner |
| y | number | 0 | No | The y-coordinate of the video's top-left corner |
| width | number | 300 | No | The width of the video |
| height | number | 150 | No | The height of the video |
| src | string | Yes | The resource URL of the video | |
| poster | string | No | The cover image of the video | |
| initialTime | number | 0 | No | The initial playback position of the video, in seconds (s) |
| playbackRate | number | 1.0 | No | The playback rate of the video; valid values are 0.5, 0.8, 1.0, 1.25, 1.5 |
| live | boolean | false | No | Whether the video is a live stream |
| objectFit | string | 'contain' | No | The scaling mode of the video. Valid values: fill, contain, cover |
| controls | boolean | true | No | Whether the video shows controls |
| showProgress | boolean | true | No | Whether to show the progress bar at the bottom of the video |
| showProgressInControlMode | boolean | true | No | Whether to show the progress bar in the control bar |
| backgroundColor | string | '#000000' | No | The background color of the video |
| autoplay | boolean | false | No | Whether the video plays automatically |
| loop | boolean | false | No | Whether the video plays in a loop |
| muted | boolean | false | No | Whether the video plays muted |
| obeyMuteSwitch | boolean | false | No | Whether the video obeys the system mute switch setting (iOS only) |
| enableProgressGesture | boolean | true | No | Whether to enable gesture control of the playback progress |
| enablePlayGesture | boolean | false | No | Whether to enable the double-tap-to-play gesture |
| showCenterPlayBtn | boolean | true | No | Whether to show the play button in the center of the video |
| underGameView | boolean | false | No | Whether the video is displayed beneath the game canvas |
| autoPauseIfNavigate | boolean | true | No | Automatically pause playback after the video navigates away |
| autoPauseIfOpenNative | boolean | true | No | Automatically pause playback after the video navigates to a native page |
Valid values of objectFit
| Value | Description |
|---|---|
| fill | Stretches the video to fill the entire container without necessarily preserving its original aspect ratio. |
| contain | Preserves the original aspect ratio and scales the video to fit entirely within the container. Some empty space may remain. |
| cover | Preserves the original aspect ratio and scales the video to cover the entire container, with at least one dimension matching the container. Parts of the video may be cropped. |
Return Value
- Video: the video object
