Skip to content

Commit 431ccef

Browse files
authored
Merge pull request #397 from caohongz/fix--stuttering-when-start-playing-with-large-videos
Fix stuttering when start playing with large videos
2 parents 0ccdf1a + b9d3a02 commit 431ccef

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

.changeset/ninety-scissors-remain.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@webav/av-canvas': patch
3+
---
4+
5+
fix: stuttering when start playing with large videos

packages/av-canvas/src/av-canvas.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ export class AVCanvas {
340340
this.#sprMapAudioNode.set(vs, audioNode);
341341
}
342342
await this.#spriteManager.addSprite(vs);
343+
vs.preFrame(0);
343344
};
344345
/**
345346
* 删除 {@link VisibleSprite}

packages/av-cliper/src/sprite/visible-sprite.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ export class VisibleSprite extends BaseSprite {
7171
* 提前准备指定 time 的帧
7272
*/
7373
preFrame(time: number) {
74+
if (this.#lastTime === time) return;
7475
this.#update(time);
76+
this.#lastTime = time;
7577
}
7678

7779
#lastTime = -1;

0 commit comments

Comments
 (0)