通过视频url,获取缩略图
getVideoImg (url) {
let _this = this
let video = document.createElement('video')
video.src = url
video.width = 503
video.height = 295
video.setAttribute('crossOrigin', 'Anonymous')
video.autoplay = true
video.addEventListener('loadeddata', () => {
setTimeout(() => {
let canvas = document.createElement('canvas')
canvas.width = 503
canvas.height = 503
let ctx = canvas.getContext('2d')
let imgHeight = video.videoHeight
let imgWidth = video.videoWidth
ctx.drawImage(video, 0, 0, imgWidth, imgHeight, 0, 0, video.width, video.width)
let img = canvas.toDataURL('image/png')
_this.$set(_this.imgList, url, img)
}, 10)
}, false)
},