fix bug https://github.com/AriaLyy/Aria/issues/690
m3u8任务增加`setUseDefConvert()`方法,用于处理默认的m3u8任务
This commit is contained in:
laoyuyu
2020-06-14 15:03:15 +08:00
parent 29f9bdcdbd
commit 418ec74b7b
19 changed files with 181 additions and 49 deletions

View File

@@ -266,15 +266,10 @@ public class M3U8LiveDLoadActivity extends BaseActivity<ActivityM3u8LiveBinding>
}
static class BandWidthUrlConverter implements IBandWidthUrlConverter {
String url;
BandWidthUrlConverter(String url) {
this.url = url;
}
@Override public String convert(String bandWidthUrl) {
int peerIndex = url.lastIndexOf("/");
return url.substring(0, peerIndex + 1) + bandWidthUrl;
@Override public String convert(String m3u8Url, String bandWidthUrl) {
int peerIndex = m3u8Url.lastIndexOf("/");
return m3u8Url.substring(0, peerIndex + 1) + bandWidthUrl;
}
}
}

View File

@@ -304,14 +304,14 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
private M3U8VodOption getM3U8Option() {
M3U8VodOption option = new M3U8VodOption();
option
.setBandWidth(200000)
//option.setBandWidth(200000);
//.generateIndexFile()
//.merge(true)
.setVodTsUrlConvert(new VodTsUrlConverter());
//.setVodTsUrlConvert(new VodTsUrlConverter());
//.setMergeHandler(new TsMergeHandler());
option.setKeyUrlConverter(new KeyUrlConverter());
option.setBandWidthUrlConverter(new BandWidthUrlConverter(mUrl));
//option.setKeyUrlConverter(new KeyUrlConverter());
//option.setBandWidthUrlConverter(new BandWidthUrlConverter());
//option.setUseDefConvert(true);
return option;
}
@@ -327,7 +327,8 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
static class VodTsUrlConverter implements IVodTsUrlConverter {
@Override public List<String> convert(String m3u8Url, List<String> tsUrls) {
Uri uri = Uri.parse(m3u8Url);
String parentUrl = "http://devimages.apple.com/iphone/samples/bipbop/gear1/";
//String parentUrl = "http://devimages.apple.com/iphone/samples/bipbop/gear1/";
String parentUrl = "http://youku.cdn7-okzy.com/20200123/16815_fbe419ed/1000k/hls/";
//String parentUrl = "http://" + uri.getHost() + "/gear1/";
//int index = m3u8Url.lastIndexOf("/");
//String parentUrl = m3u8Url.substring(0, index + 1);
@@ -351,15 +352,10 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
static class BandWidthUrlConverter implements IBandWidthUrlConverter {
private String url;
BandWidthUrlConverter(String url) {
this.url = url;
}
@Override public String convert(String bandWidthUrl) {
int index = url.lastIndexOf("/");
return url.substring(0, index + 1) + bandWidthUrl;
@Override public String convert(String m3u8Url, String bandWidthUrl) {
int index = m3u8Url.lastIndexOf("/");
return m3u8Url.substring(0, index + 1) + bandWidthUrl;
}
}

View File

@@ -35,6 +35,8 @@ public class M3U8VodModule extends BaseViewModule {
//private final String defUrl = "https://www.gaoya123.cn/2019/1557993797897.m3u8";
// 多码率地址:
private final String defUrl = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8";
//private final String defUrl = "http://youku.cdn7-okzy.com/20200123/16815_fbe419ed/index.m3u8";
//private final String defUrl = "https://cn7.kankia.com/hls/20200108/e1eaec074274c64fe46a3bdb5d2ba487/1578488360/index.m3u8";
//private final String defUrl = "https://youku.cdn7-okzy.com/20191213/16167_c3592a02/index.m3u8";
//private final String defUrl = "http://qn.shytong.cn/b83137769ff6b555/11b0c9970f9a3fa0.mp4.m3u8";