mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-24 00:50:32 +00:00
add suport for dash
This commit is contained in:
parent
9204a89319
commit
46c2db310a
@ -95,6 +95,10 @@ public abstract class VideoExtractor {
|
|||||||
if (videoInfo.startPosition < 0) {
|
if (videoInfo.startPosition < 0) {
|
||||||
videoInfo.startPosition = getTimeStamp();
|
videoInfo.startPosition = getTimeStamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(videoInfo.dashMpdUrl.isEmpty()) {
|
||||||
|
videoInfo.dashMpdUrl = getDashMpdUrl();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
videoInfo.errorCode = getErrorCode();
|
videoInfo.errorCode = getErrorCode();
|
||||||
videoInfo.errorMessage = getErrorMessage();
|
videoInfo.errorMessage = getErrorMessage();
|
||||||
@ -125,4 +129,5 @@ public abstract class VideoExtractor {
|
|||||||
public abstract String getUploaderThumbnailUrl();
|
public abstract String getUploaderThumbnailUrl();
|
||||||
public abstract VideoInfo.AudioStream[] getAudioStreams();
|
public abstract VideoInfo.AudioStream[] getAudioStreams();
|
||||||
public abstract VideoInfo.VideoStream[] getVideoStreams();
|
public abstract VideoInfo.VideoStream[] getVideoStreams();
|
||||||
|
public abstract String getDashMpdUrl();
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,11 @@ public class VideoInfo extends AbstractVideoInfo {
|
|||||||
public String description = "";
|
public String description = "";
|
||||||
public VideoStream[] videoStreams = null;
|
public VideoStream[] videoStreams = null;
|
||||||
public AudioStream[] audioStreams = 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 int errorCode = NO_ERROR;
|
||||||
public String errorMessage = "";
|
public String errorMessage = "";
|
||||||
public int duration = -1;
|
public int duration = -1;
|
||||||
@ -50,7 +55,8 @@ public class VideoInfo extends AbstractVideoInfo {
|
|||||||
public String average_rating = "";
|
public String average_rating = "";
|
||||||
public VideoPreviewInfo nextVideo = null;
|
public VideoPreviewInfo nextVideo = null;
|
||||||
public List<VideoPreviewInfo> relatedVideos = 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() {}
|
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
|
@Override
|
||||||
public VideoInfo.AudioStream[] getAudioStreams() {
|
public VideoInfo.AudioStream[] getAudioStreams() {
|
||||||
try {
|
try {
|
||||||
String dashManifest = playerArgs.getString("dashmpd");
|
String dashManifest = playerArgs.getString("dashmpd");
|
||||||
|
Log.d(TAG, dashManifest);
|
||||||
return parseDashManifest(dashManifest, decryptionCode);
|
return parseDashManifest(dashManifest, decryptionCode);
|
||||||
|
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user