可以参考以下代码:
this.#decoder = media.createMediaDecoder();
this.#decoder.on('frameAvailable', (decoderFrame) => {
//解码后续帧事件回调类型
console.info('MediaDecoder[MediaDecoder] frameAvailable is called,'
+ 'size.width is :' + decoderFrame.size.width
+ ',size.height is :' + decoderFrame.size.height
+ ',时间戳:' + decoderFrame.pts
+ ',状态变化数据:' + decoderFrame.buffer
);
});
this.#decoder.start(uri, mediaType);//uri:视频源,mediaType:0(video)、1(audio)
this.#decoder.seek(timeMs);//跳转到指定帧
this.#decoder.requestFrame();//开始解码
可以参考以下代码:
this.#decoder = media.createMediaDecoder();
this.#decoder.on('frameAvailable', (decoderFrame) => {
//解码后续帧事件回调类型
console.info('MediaDecoder[MediaDecoder] frameAvailable is called,'
+ 'size.width is :' + decoderFrame.size.width
+ ',size.height is :' + decoderFrame.size.height
+ ',时间戳:' + decoderFrame.pts
+ ',状态变化数据:' + decoderFrame.buffer
);
});
this.#decoder.start(uri, mediaType);//uri:视频源,mediaType:0(video)、1(audio)
this.#decoder.seek(timeMs);//跳转到指定帧
this.#decoder.requestFrame();//开始解码
举报