|
|
@ -95,9 +95,21 @@ public abstract class BaseM3U8Loader extends AbsNormalLoader<DTaskWrapper> { |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} else if (line.startsWith("#EXT-X-KEY")) { |
|
|
|
} else if (line.startsWith("#EXT-X-KEY")) { |
|
|
|
M3U8Entity m3U8Entity = getEntity().getM3U8Entity(); |
|
|
|
M3U8Entity m3U8Entity = getEntity().getM3U8Entity(); |
|
|
|
String keyInfo = String.format("#EXT-X-KEY:METHOD=%s,URI=\"%s\",IV=%s\r\n", m3U8Entity.method, |
|
|
|
StringBuilder sb = new StringBuilder("#EXT-X-KEY:"); |
|
|
|
m3U8Entity.keyPath, m3U8Entity.iv); |
|
|
|
sb.append("METHOD=").append(m3U8Entity.method); |
|
|
|
bytes = keyInfo.getBytes(Charset.forName("UTF-8")); |
|
|
|
sb.append(",URI=\"").append(m3U8Entity.keyPath).append("\""); |
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(m3U8Entity.iv)) { |
|
|
|
|
|
|
|
sb.append(",IV=").append(m3U8Entity.iv); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(m3U8Entity.keyFormat)) { |
|
|
|
|
|
|
|
sb.append(",KEYFORMAT=\"").append(m3U8Entity.keyFormat).append("\""); |
|
|
|
|
|
|
|
sb.append(",KEYFORMATVERSIONS=\"") |
|
|
|
|
|
|
|
.append(TextUtils.isEmpty(m3U8Entity.keyFormatVersion) ? "1" |
|
|
|
|
|
|
|
: m3U8Entity.keyFormatVersion) |
|
|
|
|
|
|
|
.append("\""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
sb.append("\r\n"); |
|
|
|
|
|
|
|
bytes = sb.toString().getBytes(Charset.forName("UTF-8")); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
bytes = line.concat("\r\n").getBytes(Charset.forName("UTF-8")); |
|
|
|
bytes = line.concat("\r\n").getBytes(Charset.forName("UTF-8")); |
|
|
|
} |
|
|
|
} |
|
|
|