瀏覽代碼

feat: presentedFrames

showgao 4 年之前
父節點
當前提交
66c1f2b5f2
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      web/src/webgl-render-vap.ts

+ 1 - 1
web/src/webgl-render-vap.ts

@@ -285,7 +285,7 @@ export default class WebglRenderVap extends VapVideo {
 
   drawFrame(_, info) {
     const timePoint = (info && info.mediaTime >= 0) ? info.mediaTime : this.video.currentTime
-    const frame = Math.round(timePoint * this.options.fps) + this.options.offset;
+    const frame = info && info.presentedFrames > 0 ? info.presentedFrames - 1 : Math.round(timePoint * this.options.fps) + this.options.offset;
     const frameCbs = this.events['frame'] || []
     frameCbs.forEach(cb => {
       cb(frame + 1, timePoint)