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

@@ -328,9 +328,10 @@ final public class M3U8InfoTask implements IInfoTask {
* 处理码率
*/
private void handleBandWidth(HttpURLConnection conn, String bandWidthM3u8Url) throws IOException {
IBandWidthUrlConverter converter = mM3U8Option.getBandWidthUrlConverter();
IBandWidthUrlConverter converter = mM3U8Option.isUseDefConvert() ? new BandWidthDefConverter()
: mM3U8Option.getBandWidthUrlConverter();
if (converter != null) {
bandWidthM3u8Url = converter.convert(bandWidthM3u8Url);
bandWidthM3u8Url = converter.convert(mEntity.getUrl(), bandWidthM3u8Url);
if (!bandWidthM3u8Url.startsWith("http")) {
failDownload(String.format("码率转换器转换后的url地址无效转换后的url%s", bandWidthM3u8Url), false);
return;