# wx.chooseVideo(Object object)
with Promise style call: Supported
Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6
Shoot a video or select a video from your phone album.
# parameter
# Object object
attribute | type | Default values | Required | Introductions | Minimum version |
---|---|---|---|---|---|
sourceType | Array.<string> | ['album', 'camera'] | no | Source of video selection | |
compressed | boolean | true | no | Whether to compress the selected video file | 1.6.0 |
maxDuration | number | 60 | no | Maximum time to shoot video, per second | |
camera | string | 'back' | no | The default pull is the front or rear camera. part Android Mobile phone down due to system ROME No support. Can't take effect. | |
success | function | no | Interface calls the successful callback function | ||
fail | function | no | Interface calls failed callback functions | ||
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
object.sourceType Legal value
value | Introductions | Minimum version |
---|---|---|
album | Select video from album | |
camera | Use your camera to shoot video |
object.camera Legal value
value | Introductions | Minimum version |
---|---|---|
back | Default pull up rear camera | |
front | Default pull up front camera |
# object.success callback
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
tempFilePath | string | Temporary file path for selected video (Local path) |
duration | number | Time length of selected video |
size | number | Amount of data for selected video |
height | number | Returns the height of the selected video |
width | number | Returns the width of the selected video |
# sample code
wx.chooseVideo({
sourceType: ['album','camera'],
maxDuration: 60,
camera: 'back',
success(res) {
console.log(res.tempFilePath)
}
})