mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-11-04 01:03:00 +00:00 
			
		
		
		
	add suport for dash
This commit is contained in:
		@@ -95,6 +95,10 @@ public abstract class VideoExtractor {
 | 
			
		||||
            if (videoInfo.startPosition < 0) {
 | 
			
		||||
                videoInfo.startPosition = getTimeStamp();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if(videoInfo.dashMpdUrl.isEmpty()) {
 | 
			
		||||
                videoInfo.dashMpdUrl = getDashMpdUrl();
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            videoInfo.errorCode = getErrorCode();
 | 
			
		||||
            videoInfo.errorMessage = getErrorMessage();
 | 
			
		||||
@@ -125,4 +129,5 @@ public abstract class VideoExtractor {
 | 
			
		||||
    public abstract String getUploaderThumbnailUrl();
 | 
			
		||||
    public abstract VideoInfo.AudioStream[] getAudioStreams();
 | 
			
		||||
    public abstract VideoInfo.VideoStream[] getVideoStreams();
 | 
			
		||||
    public abstract String getDashMpdUrl();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,11 @@ public class VideoInfo extends AbstractVideoInfo {
 | 
			
		||||
    public String description = "";
 | 
			
		||||
    public VideoStream[] videoStreams = null;
 | 
			
		||||
    public AudioStream[] audioStreams = null;
 | 
			
		||||
    // video streams provided by the dash mpd do not need to be provided as VideoStream.
 | 
			
		||||
    // Later on this will also aplly to audio streams. Since dash mpd is standarized,
 | 
			
		||||
    // crawling such a file is not service dependent. Therefore getting audio only streams by yust
 | 
			
		||||
    // providing the dash mpd fille will be possible in the future.
 | 
			
		||||
    public String dashMpdUrl = "";
 | 
			
		||||
    public int errorCode = NO_ERROR;
 | 
			
		||||
    public String errorMessage = "";
 | 
			
		||||
    public int duration = -1;
 | 
			
		||||
@@ -50,7 +55,8 @@ public class VideoInfo extends AbstractVideoInfo {
 | 
			
		||||
    public String average_rating = "";
 | 
			
		||||
    public VideoPreviewInfo nextVideo = null;
 | 
			
		||||
    public List<VideoPreviewInfo> relatedVideos = null;
 | 
			
		||||
    public int startPosition = -1;//in seconds. some metadata is not passed using a VideoInfo object!
 | 
			
		||||
    //in seconds. some metadata is not passed using a VideoInfo object!
 | 
			
		||||
    public int startPosition = -1;
 | 
			
		||||
 | 
			
		||||
    public VideoInfo() {}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -220,10 +220,23 @@ public class YoutubeVideoExtractor extends VideoExtractor {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String getDashMpdUrl() {
 | 
			
		||||
        try {
 | 
			
		||||
            return playerArgs.getString("dashmpd");
 | 
			
		||||
        } catch(NullPointerException e) {
 | 
			
		||||
            Log.e(TAG, "Could not find \"dashmpd\" upon the player args (maybe no dash manifest available).");
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
        return "";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public VideoInfo.AudioStream[] getAudioStreams() {
 | 
			
		||||
        try {
 | 
			
		||||
            String dashManifest = playerArgs.getString("dashmpd");
 | 
			
		||||
            Log.d(TAG, dashManifest);
 | 
			
		||||
            return parseDashManifest(dashManifest, decryptionCode);
 | 
			
		||||
 | 
			
		||||
        } catch (NullPointerException e) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user