Merge pull request #661 from B0pol/peertube-livestreams
[PeerTube] Support livestreams
This commit is contained in:
commit
c38a06e8dc
2 changed files with 8 additions and 3 deletions
|
@ -199,7 +199,7 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getHlsUrl() {
|
public String getHlsUrl() {
|
||||||
return "";
|
return json.getArray("streamingPlaylists").getObject(0).getString("playlistUrl");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -227,6 +227,11 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
||||||
throw new ParsingException("Could not get video streams", e);
|
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;
|
return videoStreams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +288,7 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamType getStreamType() {
|
public StreamType getStreamType() {
|
||||||
return StreamType.VIDEO_STREAM;
|
return json.getBoolean("isLive") ? StreamType.LIVE_STREAM : StreamType.VIDEO_STREAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class PeertubeStreamInfoItemExtractor implements StreamInfoItemExtractor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamType getStreamType() {
|
public StreamType getStreamType() {
|
||||||
return StreamType.VIDEO_STREAM;
|
return item.getBoolean("isLive") ? StreamType.LIVE_STREAM : StreamType.VIDEO_STREAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue