mirror of
https://github.com/TeamNewPipe/NewPipeExtractor
synced 2025-08-31 06:15:37 +00:00
[PeerTube] Detect video-only streams
This commit is contained in:
@@ -652,11 +652,17 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||||||
final MediaFormat format = MediaFormat.getFromSuffix(extension);
|
final MediaFormat format = MediaFormat.getFromSuffix(extension);
|
||||||
final String id = resolution + "-" + extension;
|
final String id = resolution + "-" + extension;
|
||||||
|
|
||||||
|
// Check if the hasAudio property is present to keep compatibility with instances < 6.3.0,
|
||||||
|
// otherwise any video stream with an audio track will be marked as video only for these
|
||||||
|
// instances
|
||||||
|
final boolean isVideoOnly = streamJsonObject.has("hasAudio")
|
||||||
|
&& !streamJsonObject.getBoolean("hasAudio");
|
||||||
|
|
||||||
// Add progressive HTTP streams first
|
// Add progressive HTTP streams first
|
||||||
videoStreams.add(new VideoStream.Builder()
|
videoStreams.add(new VideoStream.Builder()
|
||||||
.setId(id + "-" + idSuffix + "-" + DeliveryMethod.PROGRESSIVE_HTTP)
|
.setId(id + "-" + idSuffix + "-" + DeliveryMethod.PROGRESSIVE_HTTP)
|
||||||
.setContent(url, true)
|
.setContent(url, true)
|
||||||
.setIsVideoOnly(false)
|
.setIsVideoOnly(isVideoOnly)
|
||||||
.setResolution(resolution)
|
.setResolution(resolution)
|
||||||
.setMediaFormat(format)
|
.setMediaFormat(format)
|
||||||
.build());
|
.build());
|
||||||
@@ -671,7 +677,7 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||||||
final VideoStream videoStream = new VideoStream.Builder()
|
final VideoStream videoStream = new VideoStream.Builder()
|
||||||
.setId(id + "-" + DeliveryMethod.HLS)
|
.setId(id + "-" + DeliveryMethod.HLS)
|
||||||
.setContent(hlsStreamUrl, true)
|
.setContent(hlsStreamUrl, true)
|
||||||
.setIsVideoOnly(false)
|
.setIsVideoOnly(isVideoOnly)
|
||||||
.setDeliveryMethod(DeliveryMethod.HLS)
|
.setDeliveryMethod(DeliveryMethod.HLS)
|
||||||
.setResolution(resolution)
|
.setResolution(resolution)
|
||||||
.setMediaFormat(format)
|
.setMediaFormat(format)
|
||||||
@@ -688,7 +694,7 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||||||
videoStreams.add(new VideoStream.Builder()
|
videoStreams.add(new VideoStream.Builder()
|
||||||
.setId(id + "-" + idSuffix + "-" + DeliveryMethod.TORRENT)
|
.setId(id + "-" + idSuffix + "-" + DeliveryMethod.TORRENT)
|
||||||
.setContent(torrentUrl, true)
|
.setContent(torrentUrl, true)
|
||||||
.setIsVideoOnly(false)
|
.setIsVideoOnly(isVideoOnly)
|
||||||
.setDeliveryMethod(DeliveryMethod.TORRENT)
|
.setDeliveryMethod(DeliveryMethod.TORRENT)
|
||||||
.setResolution(resolution)
|
.setResolution(resolution)
|
||||||
.setMediaFormat(format)
|
.setMediaFormat(format)
|
||||||
|
Reference in New Issue
Block a user