Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Youtube premieres identified by isLive videoDetails json key #715

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ private AudioTrackInfo loadTrackInfo() {

TemporalInfo temporalInfo = TemporalInfo.fromRawData(
videoDetails.get("isLiveContent").asBoolean(false),
videoDetails.get("isLive").asBoolean(false),
videoDetails.get("lengthSeconds")
);

Expand All @@ -109,6 +110,7 @@ private AudioTrackInfo loadLegacyTrackInfo() {

TemporalInfo temporalInfo = TemporalInfo.fromRawData(
"1".equals(args.get("live_playback").text()),
false,
args.get("length_seconds")
);

Expand All @@ -129,11 +131,11 @@ private TemporalInfo(boolean isActiveStream, long durationMillis) {
this.durationMillis = durationMillis;
}

public static TemporalInfo fromRawData(boolean wasLiveStream, JsonBrowser durationSecondsField) {
public static TemporalInfo fromRawData(boolean wasLiveStream, boolean isSpecifiedLive, JsonBrowser durationSecondsField) {
long durationValue = durationSecondsField.asLong(0L);
// VODs are not really live streams, even though that field in JSON claims they are. If it is actually live, then
// duration is also missing or 0.
boolean isActiveStream = wasLiveStream && durationValue == 0;
boolean isActiveStream = isSpecifiedLive || (wasLiveStream && durationValue == 0);

return new TemporalInfo(
isActiveStream,
Expand Down