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

[PeerTube] Support livestreams #661

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
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 @@ -199,7 +199,7 @@ public String getDashMpdUrl() {
@Nonnull
@Override
public String getHlsUrl() {
return "";
return json.getArray("streamingPlaylists").getObject(0).getString("playlistUrl");
}

@Override
Expand Down Expand Up @@ -227,6 +227,11 @@ public List<VideoStream> getVideoStreams() throws ExtractionException {
throw new ParsingException("Could not get video streams", e);
}

if (getStreamType() == StreamType.LIVE_STREAM) {
final String url = getHlsUrl();
videoStreams.add(new VideoStream(url, MediaFormat.MPEG_4, "720p"));
}

return videoStreams;
}

Expand Down Expand Up @@ -283,7 +288,7 @@ public List<SubtitlesStream> getSubtitles(final MediaFormat format) {

@Override
public StreamType getStreamType() {
return StreamType.VIDEO_STREAM;
return json.getBoolean("isLive") ? StreamType.LIVE_STREAM : StreamType.VIDEO_STREAM;
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public DateWrapper getUploadDate() throws ParsingException {

@Override
public StreamType getStreamType() {
return StreamType.VIDEO_STREAM;
return item.getBoolean("isLive") ? StreamType.LIVE_STREAM : StreamType.VIDEO_STREAM;
}

@Override
Expand Down