Skip to content

Commit c38a06e

Browse files
authored
Merge pull request #661 from B0pol/peertube-livestreams
[PeerTube] Support livestreams
2 parents b45bb41 + 7d7cc08 commit c38a06e

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public String getDashMpdUrl() {
199199
@Nonnull
200200
@Override
201201
public String getHlsUrl() {
202-
return "";
202+
return json.getArray("streamingPlaylists").getObject(0).getString("playlistUrl");
203203
}
204204

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

230+
if (getStreamType() == StreamType.LIVE_STREAM) {
231+
final String url = getHlsUrl();
232+
videoStreams.add(new VideoStream(url, MediaFormat.MPEG_4, "720p"));
233+
}
234+
230235
return videoStreams;
231236
}
232237

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

284289
@Override
285290
public StreamType getStreamType() {
286-
return StreamType.VIDEO_STREAM;
291+
return json.getBoolean("isLive") ? StreamType.LIVE_STREAM : StreamType.VIDEO_STREAM;
287292
}
288293

289294
@Nullable

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamInfoItemExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public DateWrapper getUploadDate() throws ParsingException {
8282

8383
@Override
8484
public StreamType getStreamType() {
85-
return StreamType.VIDEO_STREAM;
85+
return item.getBoolean("isLive") ? StreamType.LIVE_STREAM : StreamType.VIDEO_STREAM;
8686
}
8787

8888
@Override

0 commit comments

Comments
 (0)