Chuyển tới nội dung chính

previewVideo

previewVideo là API dùng để preview view từ đường dẫn cục bộ ví dụ từ chooseVideo hoặc đường dẫn remote online

Tham số

Thuộc tínhKiểu dữ liệuBắt buộcMô tả
urlstringĐường dẫn cục bộ hoặc online
successFunctionCallback function khi preview video thành công
failFunctionCallback function khi preview video bất thành.
completeFunctionCallback function khi gọi API hoàn tất bất kể có preview video hay không.

Callback function payload

Không có

Ví dụ

import apis from '@v-miniapp/apis'

function onChooseVideo() {
apis.chooseVideo({
camera: 'front',
maxDuration: 15,
includeThumbnail: true,
success: res => {
apis.alert({ content: JSON.stringify(res) })
// Automatically preview images after selection
if (res.filePaths[0].length > 0) {
apis.previewVideo({
url: res.filePaths[0],
})
}
},
fail: e => {
apis.alert({ content: JSON.stringify(e) })
console.log(e)
},
})
}