diff --git a/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java b/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java index 77acc0f12..3fb0791c9 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java @@ -19,6 +19,8 @@ import com.google.android.exoplayer2.analytics.AnalyticsListener; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.android.exoplayer2.ui.StyledPlayerView; import com.google.android.exoplayer2.video.VideoSize; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.live.R; /** * 直播间播放器管理器 @@ -38,8 +40,10 @@ public class LiveExoPlayerManager { private final Handler handler; private static double log_buffer_time = 0, log_buffer_max_time; private String url = ""; + private Context mContext; public LiveExoPlayerManager(Context mContext) { + this.mContext = mContext; DefaultLoadControl control = new DefaultLoadControl.Builder() .setPrioritizeTimeOverSizeThresholds(false) .setBackBuffer(10_000, true) @@ -191,6 +195,7 @@ public class LiveExoPlayerManager { Player.Listener.super.onPlayerError(error); error.printStackTrace(); replay(); + ToastUtil.show(mContext.getString(R.string.net_error) + " :" + error.errorCode); } }); @@ -260,6 +265,7 @@ public class LiveExoPlayerManager { Player.Listener.super.onPlayerError(error); error.printStackTrace(); replay(); + ToastUtil.show(mContext.getString(R.string.net_error) + " :" + error.errorCode); } }); } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index b805b5f1c..bcac77b9d 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -257,6 +257,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void run() { loading.setVisibility(View.GONE); enterRoomLeaveHandler.post(enterRoomLeaveRunnable); + ToastUtil.show(mContext.getString(R.string.net_error) + " :500" );//异常下播,等待加载时间过了后弹出 } };