# Video wx.createVideo(Object object)

Creates videos.

# Parameters

# Object object

Attribute Type Default Required Description
x number 0 No The x-coordinate of the top-left corner of the video
y number 0 No The y-coordinate of the top-left corner of the video
width number 300 The width of the video
height number 150 The height of the video
src string No The resource address of the video
poster string No The cover of the video
initialTime number 0 No The initial time point at which the video starts to play (in sec)
playbackRate number 1.0 No Video playback speed. Available values include 0.5, 0.8, 1.0, 1.25, and 1.5.
live boolean false No Indicates whether it is live stream
objectFit string 'contain' No The zoom mode of the video
controls boolean true No Specifies whether to display controls for the video
autoplay boolean false No Specifies whether to enable auto playback for the video
loop boolean false No Specifies whether to enable loop playback for the video
muted boolean false No Specifies whether the video is muted during playback
enableProgressGesture boolean false No Specifies whether to enable gesture control of playback progress
showCenterPlayBtn boolean false No Specifies whether to display the play button in the center of the video

Valid values of object.objectFit

Value Description Minimum Version
fill Fill: The video is stretched to fit the container, without maintaining its original aspect ratio.
contain Contain: The video is zoomed in/out to maintain its aspect ratio while fitting within the container.
cover Cover: The video is sized to maintain its aspect ratio while filling the entire container. The video and the container should have the same width or height.

# Return Values

# Video

A video object that can be controlled by setting its properties and calling methods.

点击咨询小助手