Skip to content

Commit

Permalink
Ensure key frame every 5 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanilagy committed Nov 24, 2024
1 parent 05a20db commit 962c236
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions demo/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ const encodeVideoFrame = () => {
timestamp: elapsedTime * 1000
});

// Ensure a video key frame at least every 10 seconds
let needsKeyFrame = elapsedTime - lastKeyFrame >= 10000;
// Ensure a video key frame at least every 5 seconds
let needsKeyFrame = elapsedTime - lastKeyFrame >= 5000;
if (needsKeyFrame) lastKeyFrame = elapsedTime;

videoEncoder.encode(frame, { keyFrame: needsKeyFrame });
Expand Down

0 comments on commit 962c236

Please sign in to comment.