Skip to content

Commit 44adf53

Browse files
committed
[PeerTube] Detect video-only streams
1 parent 8b9ccec commit 44adf53

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,12 +651,13 @@ private void addNewVideoStream(@Nonnull final JsonObject streamJsonObject,
651651
final String extension = url.substring(url.lastIndexOf(".") + 1);
652652
final MediaFormat format = MediaFormat.getFromSuffix(extension);
653653
final String id = resolution + "-" + extension;
654+
final boolean isVideoOnly = !streamJsonObject.getBoolean("hasAudio");
654655

655656
// Add progressive HTTP streams first
656657
videoStreams.add(new VideoStream.Builder()
657658
.setId(id + "-" + idSuffix + "-" + DeliveryMethod.PROGRESSIVE_HTTP)
658659
.setContent(url, true)
659-
.setIsVideoOnly(false)
660+
.setIsVideoOnly(isVideoOnly)
660661
.setResolution(resolution)
661662
.setMediaFormat(format)
662663
.build());
@@ -671,7 +672,7 @@ private void addNewVideoStream(@Nonnull final JsonObject streamJsonObject,
671672
final VideoStream videoStream = new VideoStream.Builder()
672673
.setId(id + "-" + DeliveryMethod.HLS)
673674
.setContent(hlsStreamUrl, true)
674-
.setIsVideoOnly(false)
675+
.setIsVideoOnly(isVideoOnly)
675676
.setDeliveryMethod(DeliveryMethod.HLS)
676677
.setResolution(resolution)
677678
.setMediaFormat(format)
@@ -688,7 +689,7 @@ private void addNewVideoStream(@Nonnull final JsonObject streamJsonObject,
688689
videoStreams.add(new VideoStream.Builder()
689690
.setId(id + "-" + idSuffix + "-" + DeliveryMethod.TORRENT)
690691
.setContent(torrentUrl, true)
691-
.setIsVideoOnly(false)
692+
.setIsVideoOnly(isVideoOnly)
692693
.setDeliveryMethod(DeliveryMethod.TORRENT)
693694
.setResolution(resolution)
694695
.setMediaFormat(format)

0 commit comments

Comments
 (0)