# wx.compressVideo(Object object)
Start from base library version 2.11.0. Please remaining backward compatible.
with Promise style call: Supported
Mini Program plugin: Support, need to Mini Program base library version no less than 2.11.1
Compressed video interface. Developer can specify compression quality quality
Compress. When finer control is required, specify bitrate
、fps
, and resolution
When quality
When passed in, these three parameters are ignored. Information about the original video can be obtained through getVideoInfo Get.
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
src | string | yes | Video file path, can be temporary file path or permanent file path | |
quality | string | yes | Compression mass | |
bitrate | number | yes | Rate, unit kbps | |
fps | number | yes | frame rate | |
resolution | number | yes | Relative to the original video resolution ratio, range(0, 1] | |
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.quality Legal value
value | Introductions | Minimum version |
---|---|---|
low | low | |
medium | in | |
high | high |
# object.success callback
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
tempFilePath | string | Compressed temporary file address |
size | string | Compressed size, unit kb |