我这测试安卓也一样,只能度131帧,后面就都null了。
VideoDecoder getFrameData 在安卓上视频解码未结束,但是返回 null ?视频地址 https://cdn2.h5no1.com/static-cdn/cpbz/v.mp4 用 wx.downloadFile 下载一个 21 秒的视频,然后使用 VideoDecoder 解码,在安卓上,总是解码到 16 秒的位置就停住了,getFrameData 返回 null 没有触发 ended 事件 没有触发 stop 事件 触发了一次 bufferchange 事件 在 ios 上正常 Page({ videoSrc: 'https://cdn2.h5no1.com/static-cdn/cpbz/v.mp4', vDec: null, onReady() { this.vDec = wx.createVideoDecoder(); console.log('开始下载视频文件'); wx.downloadFile({ url: this.videoSrc, success: res => { console.log('下载视频文件完成'); this.vDec.start({ source: res.tempFilePath }); } }); this.vDec.on('start', () => { console.log('开始解码视频, 24fps'); this.timer = setInterval(() => { const frame = this.vDec.getFrameData(); if (frame) { console.log('frame', frame); // 到 16 秒的时候 就开始返回 null } }, 1000 / 24); }); this.vDec.on('ended', () => { console.log('解码视频结束 ended'); clearInterval(this.timer); }); this.vDec.on('stop', () => { console.log('stop'); }); this.vDec.on('bufferchange', () => { console.log('bufferchange'); }); } });
2020-07-28解决了 是 WebGL doesn't like Uint8ClampedArrays
iOS中引入jsmpeg,使用webgl渲染,直接绿屏了,安卓和开发者工具能正常播放如题,https://github.com/phoboslab/jsmpeg 播放ts格式的文件,绿屏
2020-07-22