Skip to content

Commit a337de7

Browse files
🩹 Fix recovering a playlist too early after a stream start
1 parent c60d9ff commit a337de7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils/getLiveVideoInfo.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ export const getLiveVideoInfo = async (
3737
if (videoMeta) videoInfo = getVideoInfoByVideoMeta(videoMeta);
3838
}
3939

40+
// A VOD is published about 5-20 seconds after a stream starts
41+
// Wait at least 30 seconds before trying to recover the playlist
42+
const checkPrivateVod = startTimestampMs + 30_000 < Date.now();
43+
4044
// private VOD
41-
if (formats.length === 0) {
45+
if (checkPrivateVod && formats.length === 0) {
4246
console.warn('[live-from-start] Recovering the playlist');
4347
const startTimestamp = startTimestampMs / 1000;
4448
const vodPath = `${channelLogin}_${streamMeta.stream.id}_${startTimestamp}`;

0 commit comments

Comments
 (0)