# wx.addVideoToFavorites(Object object)
Start from base library version 2.16.1. Please remaining backward compatible.
with Promise style call: Supported
Mini Program plugin: Not supported
Collection video
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
videoPath | string | yes | To collect the video address, it must be a local or temporary path | |
thumbPath | string | no | Thumbnail path, if left blank, use first frame of video | |
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Interface calls the end of the callback function (call success or failure will be executed) |
# sample code
// callback Writing method
wx.downloadFile({
url: URL, // Download url
success (res) {
// Download complete collection
wx.addVideoToFavorites({
videoPath: res.tempFilePath,
success() {},
fail: console.error,
})
},
fail: console.error,
})
// async await Writing method
const { tempFilePath } = await wx.downloadFile({
url: URL, // Download url
})
// Download complete collection
await wx.addVideoToFavorites({
videoPath: res.tempFilePath,
})