mp4格式视频开发工具正常,客户端mp4\m3u8均不行
canvas getContext2D drawImage无法绘制video(m3u8格式)draw() { const w = 300 let h = 200 const dpr = wx.getSystemInfoSync().pixelRatio wx.createSelectorQuery().select('#myVideo').context(res => { console.log('select video', res) const video = this.video = res.context wx.createSelectorQuery().selectAll('#cvs1').node(res => { console.log('select canvas', res) const ctx1 = res[0].node.getContext('2d') // console.error(ctx1) res[0].node.width = w * dpr res[0].node.height = h * dpr setInterval(() => { ctx1.drawImage(video, 0, 0, 960, 720, 0, 0, h * dpr, w * dpr); }, 1000 / 24) }).exec() }).exec() },
2021-12-10draw() { const dpr = wx.getSystemInfoSync().pixelRatio wx.createSelectorQuery().select('#video').context(res => { console.log('select video', res) const video = this.video = res.context wx.createSelectorQuery().selectAll('#cvs1').node(res => { console.log('select canvas', res) const ctx1 = res[0].node.getContext('2d') res[0].node.width = 300 * dpr res[0].node.height = 200 * dpr setInterval(() => { ctx1.drawImage(video, 0, 0, 300 * dpr, 200 * dpr); }, 1000 / 24) }).exec() }).exec() }, }) https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html
小程序怎么用canvas绘制video?小程序怎么用canvas绘制video?
2021-12-09