Skip to content

Commit 1ef9ebf

Browse files
committed
Fix livestream misdetection
1 parent e4ec766 commit 1ef9ebf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

common/src/main/java/dev/lavalink/youtube/track/TemporalInfo.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,26 @@ private TemporalInfo(boolean isActiveStream, long durationMillis) {
1818
// normal video? but has liveStreamability: PRRBJOn_n-Y
1919
// livestream: jfKfPfyJRdk
2020

21+
// active premieres have liveStreamability and videoDetails.isLive = true, videoDetails.isLiveContent = false.
22+
// they do retain their lengthSeconds value.
23+
2124
@NotNull
2225
public static TemporalInfo fromRawData(JsonBrowser playabilityStatus, JsonBrowser videoDetails) {
2326
JsonBrowser durationField = videoDetails.get("lengthSeconds");
2427
long durationValue = durationField.asLong(0L);
2528

26-
boolean hasLivestreamability = !playabilityStatus.get("liveStreamability").isNull();
29+
// boolean hasLivestreamability = !playabilityStatus.get("liveStreamability").isNull();
2730
boolean isLive = videoDetails.get("isLive").asBoolean(false)
2831
|| videoDetails.get("isLiveContent").asBoolean(false);
2932

30-
if (hasLivestreamability) {
33+
if (isLive) { // hasLivestreamability
3134
// Premieres have duration information, but act as a normal stream. When we play it, we don't know the
3235
// current position of it since YouTube doesn't provide such information, so assume duration is unknown.
3336
durationValue = 0;
3437
}
3538

3639
return new TemporalInfo(
37-
(isLive || hasLivestreamability) && durationValue == 0,
40+
isLive,
3841
durationValue == 0 ? DURATION_MS_UNKNOWN : Units.secondsToMillis(durationValue)
3942
);
4043
}

0 commit comments

Comments
 (0)