diff --git a/app/src/main/java/com/fongmi/android/tv/player/ExoUtil.java b/app/src/main/java/com/fongmi/android/tv/player/ExoUtil.java index 42f062f5c..20fb76779 100644 --- a/app/src/main/java/com/fongmi/android/tv/player/ExoUtil.java +++ b/app/src/main/java/com/fongmi/android/tv/player/ExoUtil.java @@ -113,19 +113,19 @@ public class ExoUtil { return MimeTypes.APPLICATION_SUBRIP; } - public static MediaSource getSource(Sub sub, Result result, int errorCode) { - return getSource(sub, result.getHeaders(), result.getRealUrl(), result.getFormat(), result.getSubs(), null, errorCode); + public static MediaSource getSource(Result result, Sub sub, int errorCode) { + return getSource(result.getHeaders(), result.getRealUrl(), result.getFormat(), result.getSubs(), sub, null, errorCode); } - public static MediaSource getSource(Sub sub, Channel channel, int errorCode) { - return getSource(sub, channel.getHeaders(), channel.getUrl(), null, Collections.emptyList(), channel.getDrm(), errorCode); + public static MediaSource getSource(Channel channel, int errorCode) { + return getSource(channel.getHeaders(), channel.getUrl(), null, Collections.emptyList(), null, channel.getDrm(), errorCode); } - public static MediaSource getSource(Sub sub, Map headers, String url, int errorCode) { - return getSource(sub, headers, url, null, new ArrayList<>(), null, errorCode); + public static MediaSource getSource(Map headers, String url, Sub sub, int errorCode) { + return getSource(headers, url, null, new ArrayList<>(), sub, null, errorCode); } - private static MediaSource getSource(Sub sub, Map headers, String url, String format, List subs, Drm drm, int errorCode) { + private static MediaSource getSource(Map headers, String url, String format, List subs, Sub sub, Drm drm, int errorCode) { Uri uri = UrlUtil.uri(url); if (sub != null) subs.add(sub); String mimeType = getMimeType(format, errorCode); diff --git a/app/src/main/java/com/fongmi/android/tv/player/Players.java b/app/src/main/java/com/fongmi/android/tv/player/Players.java index 3a1ba84d5..ed63a7de0 100644 --- a/app/src/main/java/com/fongmi/android/tv/player/Players.java +++ b/app/src/main/java/com/fongmi/android/tv/player/Players.java @@ -145,7 +145,7 @@ public class Players implements Player.Listener, IMediaPlayer.Listener, Analytic public void setSub(Sub sub) { this.sub = sub; - setMediaSource(headers, url, Constant.TIMEOUT_PLAY); + setMediaSource(headers, url); } public ExoPlayer exo() { @@ -474,13 +474,13 @@ public class Players implements Player.Listener, IMediaPlayer.Listener, Analytic } public void setMediaSource(String url) { - setMediaSource(new HashMap<>(), url, Constant.TIMEOUT_PLAY); + setMediaSource(new HashMap<>(), url); } private void setMediaSource(Result result, int timeout) { Logger.t(TAG).d(errorCode + "," + result.getRealUrl()); if (isIjk() && ijkPlayer != null) ijkPlayer.setMediaSource(IjkUtil.getSource(result)); - if (isExo() && exoPlayer != null) exoPlayer.setMediaSource(ExoUtil.getSource(sub, result, errorCode)); + if (isExo() && exoPlayer != null) exoPlayer.setMediaSource(ExoUtil.getSource(result, sub, errorCode)); if (isExo() && exoPlayer != null) exoPlayer.prepare(); setTimeoutCheck(result.getHeaders(), result.getRealUrl(), timeout); } @@ -488,17 +488,17 @@ public class Players implements Player.Listener, IMediaPlayer.Listener, Analytic private void setMediaSource(Channel channel, int timeout) { Logger.t(TAG).d(errorCode + "," + channel.getUrl()); if (isIjk() && ijkPlayer != null) ijkPlayer.setMediaSource(IjkUtil.getSource(channel)); - if (isExo() && exoPlayer != null) exoPlayer.setMediaSource(ExoUtil.getSource(sub, channel, errorCode)); + if (isExo() && exoPlayer != null) exoPlayer.setMediaSource(ExoUtil.getSource(channel, errorCode)); if (isExo() && exoPlayer != null) exoPlayer.prepare(); setTimeoutCheck(channel.getHeaders(), channel.getUrl(), timeout); } - private void setMediaSource(Map headers, String url, int timeout) { + private void setMediaSource(Map headers, String url) { Logger.t(TAG).d(errorCode + "," + url); if (isIjk() && ijkPlayer != null) ijkPlayer.setMediaSource(IjkUtil.getSource(headers, url)); - if (isExo() && exoPlayer != null) exoPlayer.setMediaSource(ExoUtil.getSource(sub, headers, url, errorCode)); + if (isExo() && exoPlayer != null) exoPlayer.setMediaSource(ExoUtil.getSource(headers, url, sub, errorCode)); if (isExo() && exoPlayer != null) exoPlayer.prepare(); - setTimeoutCheck(headers, url, timeout); + setTimeoutCheck(headers, url, Constant.TIMEOUT_PLAY); } private void setTimeoutCheck(Map headers, String url, int timeout) { @@ -572,7 +572,7 @@ public class Players implements Player.Listener, IMediaPlayer.Listener, Analytic @Override public void onParseSuccess(Map headers, String url, String from) { if (!TextUtils.isEmpty(from)) Notify.show(ResUtil.getString(R.string.parse_from, from)); - setMediaSource(headers, url, Constant.TIMEOUT_PLAY); + setMediaSource(headers, url); } @Override