pull/123/head
FongMi 3 years ago
parent fe8bd81c4d
commit 69b46fe66f
  1. 10
      app/src/main/java/com/fongmi/android/tv/event/ErrorEvent.java
  2. 13
      app/src/main/java/com/fongmi/android/tv/player/Players.java

@ -14,10 +14,6 @@ public class ErrorEvent {
EventBus.getDefault().post(new ErrorEvent(Type.URL, false));
}
public static void ads() {
EventBus.getDefault().post(new ErrorEvent(Type.ADS, false));
}
public static void parse() {
EventBus.getDefault().post(new ErrorEvent(Type.PARSE, false));
}
@ -51,10 +47,6 @@ public class ErrorEvent {
return retry;
}
public boolean isAds() {
return getType() == Type.ADS;
}
public boolean isParse() {
return getType() == Type.PARSE;
}
@ -64,6 +56,6 @@ public class ErrorEvent {
}
public enum Type {
ADS, URL, PARSE, FORMAT, TIMEOUT
URL, PARSE, FORMAT, TIMEOUT
}
}

@ -1,13 +1,10 @@
package com.fongmi.android.tv.player;
import android.net.Uri;
import androidx.annotation.NonNull;
import com.fongmi.android.tv.App;
import com.fongmi.android.tv.Constant;
import com.fongmi.android.tv.R;
import com.fongmi.android.tv.api.ApiConfig;
import com.fongmi.android.tv.bean.Channel;
import com.fongmi.android.tv.bean.Result;
import com.fongmi.android.tv.bean.Track;
@ -277,8 +274,6 @@ public class Players implements Player.Listener, IMediaPlayer.OnInfoListener, IM
public void start(Result result, boolean useParse) {
if (result.getUrl().isEmpty()) {
ErrorEvent.url();
} else if (isAds(result.getUrl())) {
ErrorEvent.ads();
} else if (result.getParse(1) == 1 || result.getJx() == 1) {
stopParse();
parseTask = ParseTask.create(this).run(result, useParse);
@ -329,14 +324,6 @@ public class Players implements Player.Listener, IMediaPlayer.OnInfoListener, IM
if (parseTask != null) parseTask.stop();
}
private boolean isAds(String url) {
try {
return ApiConfig.get().getAds().contains(Uri.parse(url).getHost());
} catch (Exception e) {
return false;
}
}
private void setMediaSource(Result result) {
SpiderDebug.log(errorCode + "," + result.getUrl() + "," + result.getHeaders());
if (isIjk()) ijkPlayer.setMediaSource(result.getPlayUrl() + result.getUrl(), result.getHeaders());

Loading…
Cancel
Save