|
|
|
|
@ -43,6 +43,7 @@ import com.fongmi.android.tv.bean.Channel; |
|
|
|
|
import com.fongmi.android.tv.bean.Drm; |
|
|
|
|
import com.fongmi.android.tv.bean.Result; |
|
|
|
|
import com.fongmi.android.tv.bean.Sub; |
|
|
|
|
import com.fongmi.android.tv.utils.Sniffer; |
|
|
|
|
import com.fongmi.android.tv.utils.UrlUtil; |
|
|
|
|
import com.github.catvod.net.OkHttp; |
|
|
|
|
import com.github.catvod.utils.Path; |
|
|
|
|
@ -66,7 +67,7 @@ public class ExoUtil { |
|
|
|
|
private static Cache cache; |
|
|
|
|
|
|
|
|
|
public static LoadControl buildLoadControl() { |
|
|
|
|
return new DefaultLoadControl(); |
|
|
|
|
return new DefaultLoadControl(Setting.getBuffer()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static TrackSelector buildTrackSelector() { |
|
|
|
|
@ -115,6 +116,7 @@ public class ExoUtil { |
|
|
|
|
|
|
|
|
|
private static String getMimeType(String format, int errorCode) { |
|
|
|
|
if (format != null) return format; |
|
|
|
|
if (errorCode == PlaybackException.ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED || errorCode == PlaybackException.ERROR_CODE_PARSING_MANIFEST_MALFORMED) return MimeTypes.APPLICATION_OCTET; |
|
|
|
|
if (errorCode == PlaybackException.ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED || errorCode == PlaybackException.ERROR_CODE_PARSING_CONTAINER_MALFORMED) return MimeTypes.APPLICATION_M3U8; |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
@ -143,7 +145,9 @@ public class ExoUtil { |
|
|
|
|
MediaItem.Builder builder = new MediaItem.Builder().setUri(uri); |
|
|
|
|
if (subs.size() > 0) builder.setSubtitleConfigurations(getSubtitles(subs)); |
|
|
|
|
if (drm != null) builder.setDrmConfiguration(drm.get()); |
|
|
|
|
builder.setAllowChunklessPreparation(Players.isHard(Players.EXO)); |
|
|
|
|
if (mimeType != null) builder.setMimeType(mimeType); |
|
|
|
|
builder.setAds(Sniffer.getRegex(uri)); |
|
|
|
|
return builder.build(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|