Skip to content

Commit

Permalink
[PeerTube] Support livestreams
Browse files Browse the repository at this point in the history
  • Loading branch information
B0pol committed Jun 18, 2021
1 parent 598de2d commit 1ae4608
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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

0 comments on commit 1ae4608

Please sign in to comment.