pull/586/head
FongMi 2 years ago
parent 627c2080ca
commit 7980cd04aa
  1. 2
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/CastActivity.java
  2. 2
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  3. 2
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/VideoActivity.java
  4. 4
      app/src/main/java/com/fongmi/android/tv/player/ExoUtil.java
  5. 5
      app/src/main/java/com/fongmi/android/tv/player/Players.java
  6. 2
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  7. 2
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/VideoActivity.java

@ -335,7 +335,7 @@ public class CastActivity extends BaseActivity implements CustomKeyDownCast.List
@Subscribe(threadMode = ThreadMode.MAIN)
public void onErrorEvent(ErrorEvent event) {
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode();
else if (mPlayers.addRetry() > 2) onError(event);
else if (mPlayers.error()) onError(event);
else onReset();
}

@ -711,7 +711,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
@Subscribe(threadMode = ThreadMode.MAIN)
public void onErrorEvent(ErrorEvent event) {
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode();
else if (mPlayers.addRetry() > 2) onError(event);
else if (mPlayers.error()) onError(event);
else fetch();
}

@ -1131,7 +1131,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
public void onErrorEvent(ErrorEvent event) {
if (isBackground()) return;
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode();
else if (mPlayers.addRetry() > 2) onError(event);
else if (mPlayers.error()) onError(event);
else onRefresh();
}

@ -116,6 +116,10 @@ public class ExoUtil {
return null;
}
public static int getRetry(int errorCode) {
return errorCode >= PlaybackException.ERROR_CODE_PARSING_CONTAINER_MALFORMED && errorCode <= PlaybackException.ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED ? 2 : 1;
}
public static MediaSource getSource(Result result, Sub sub, int errorCode) {
return getSource(result.getHeaders(), result.getRealUrl(), result.getFormat(), result.getSubs(), sub, null, errorCode);
}

@ -162,9 +162,8 @@ public class Players implements Player.Listener, AnalyticsListener, ParseCallbac
this.url = null;
}
public int addRetry() {
++retry;
return retry;
public boolean error() {
return ++retry > ExoUtil.getRetry(error);
}
public String stringToTime(long time) {

@ -770,7 +770,7 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
@Subscribe(threadMode = ThreadMode.MAIN)
public void onErrorEvent(ErrorEvent event) {
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode();
else if (mPlayers.addRetry() > 2) onError(event);
else if (mPlayers.error()) onError(event);
else fetch();
}

@ -1141,7 +1141,7 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
public void onErrorEvent(ErrorEvent event) {
if (isRedirect()) return;
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode();
else if (mPlayers.addRetry() > 2) onError(event);
else if (mPlayers.error()) onError(event);
else onRefresh();
}

Loading…
Cancel
Save