|
|
@@ -18,6 +18,8 @@ import com.yingyang.livebroadcast.R
|
|
|
import com.yingyang.livebroadcast.databinding.ActivityLiveBroadcastBinding
|
|
|
import com.yingyang.livebroadcast.dialog.GameTasksDialog
|
|
|
import com.yingyangfly.baselib.bean.MessageBean
|
|
|
+import com.yingyangfly.baselib.dialog.MessageDialog
|
|
|
+import com.yingyangfly.baselib.dialog.TaskFragment
|
|
|
import com.yingyangfly.baselib.ext.*
|
|
|
import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
@@ -115,7 +117,55 @@ class LiveBroadcastActivity :
|
|
|
CrashReport.postCatchedException(Throwable("直播报错 -----> [Player] onError: player-$player code-$code msg-$msg info-$extraInfo"))
|
|
|
}
|
|
|
|
|
|
+ override fun onWarning(
|
|
|
+ player: V2TXLivePlayer?,
|
|
|
+ code: Int,
|
|
|
+ msg: String?,
|
|
|
+ extraInfo: Bundle?
|
|
|
+ ) {
|
|
|
+ super.onWarning(player, code, msg, extraInfo)
|
|
|
+ when (code) {
|
|
|
+ V2TXLiveCode.V2TXLIVE_ERROR_REQUEST_TIMEOUT -> {
|
|
|
+ "请求服务器超时".toast()
|
|
|
+ }
|
|
|
+
|
|
|
+ V2TXLiveCode.V2TXLIVE_ERROR_DISCONNECTED -> {
|
|
|
+ "连接断开".toast()
|
|
|
+ }
|
|
|
+
|
|
|
+ V2TXLiveCode.V2TXLIVE_WARNING_NETWORK_BUSY -> {
|
|
|
+ "网络状况不佳".toast()
|
|
|
+ }
|
|
|
|
|
|
+ V2TXLiveCode.V2TXLIVE_WARNING_VIDEO_BLOCK -> {
|
|
|
+ "当前视频播放出现卡顿".toast()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onVideoLoading(player: V2TXLivePlayer?, extraInfo: Bundle?) {
|
|
|
+ super.onVideoLoading(player, extraInfo)
|
|
|
+ val messageDialog = MessageDialog()
|
|
|
+ messageDialog.setContent("", "", "直播结束")
|
|
|
+ messageDialog.onDialogClickListener = {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ messageDialog.show(supportFragmentManager, "taskFragment")
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onVideoPlaying(
|
|
|
+ player: V2TXLivePlayer?,
|
|
|
+ firstPlay: Boolean,
|
|
|
+ extraInfo: Bundle?
|
|
|
+ ) {
|
|
|
+ super.onVideoPlaying(player, firstPlay, extraInfo)
|
|
|
+ if (firstPlay) {
|
|
|
+ Log.e("wpp", "--------------------------777")
|
|
|
+ } else {
|
|
|
+ Log.e("wpp", "--------------------------666")
|
|
|
+ }
|
|
|
+ "直播开始".toast()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun onDestroy() {
|