From 4e374efd1e13187511dd181b0a5d1e9e8a7f9f85 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 23 Jul 2020 15:25:30 +0800 Subject: [PATCH 1/2] upgrade tanlu version --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 90669c17d7..5c9f866ed9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -60,7 +60,7 @@ MOGO_MODULE_V2X_VERSION=1.2.1.20 ## 工程外部模块 # 探路 -MOGO_MODULE_TANLU_VERSION=1.3.1.2 +MOGO_MODULE_TANLU_VERSION=1.3.1.5 # 车聊聊 CARCHATTING_VERSION=1.4.6 # 车聊聊接口 @@ -78,7 +78,7 @@ MOGO_MODULE_PUSH_NOOP_VERSION=1.1.5.6 # 广告资源位 MOGO_MODULE_AD_CARD_VERSION=1.0.1 # 探路上报和分享模块 -TANLULIB_VERSION=1.3.1.2 +TANLULIB_VERSION=1.3.1.5 MOGO_MODULE_EVENT_PANEL_VERSION = 1.0.0-SNAPSHOT MOGO_MODULE_EVENT_PANEL_NOOP_VERSION = 1.0.0-SNAPSHOT #左侧面板模块 From 43e7bd569cf07ce90b3f119fc4f7d0bfa2e383a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Thu, 23 Jul 2020 16:52:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=87=8D=E8=AF=95=E6=AC=A1=E6=95=B0=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E8=AF=81=E5=8F=AF=E4=BB=A5=E6=92=AD=E5=87=BA=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scene/livecar/V2XRoadLiveCarWindow.java | 1 - .../module/v2x/view/V2XLiveGSYVideoView.java | 87 ++++++++++++------- 2 files changed, 55 insertions(+), 33 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XRoadLiveCarWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XRoadLiveCarWindow.java index 857146eb14..90936e2281 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XRoadLiveCarWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XRoadLiveCarWindow.java @@ -218,7 +218,6 @@ public class V2XRoadLiveCarWindow extends RelativeLayout // 倒计时 if (runnableV2XEvent == null) { runnableV2XEvent = () -> { - Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。"); // 移出Window详细信息 mTvEventStubClose.setText((countDownTime--) + "s"); handlerV2XEvent.postDelayed(runnableV2XEvent, 1000); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XLiveGSYVideoView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XLiveGSYVideoView.java index d5d4801e0e..cf25fe1b0d 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XLiveGSYVideoView.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XLiveGSYVideoView.java @@ -25,8 +25,10 @@ import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; import com.mogo.module.v2x.voice.V2XVoiceConstants; import com.mogo.module.v2x.voice.V2XVoiceManager; import com.mogo.utils.logger.Logger; +import com.mogo.utils.network.utils.GsonUtil; import com.tencent.rtmp.ITXLivePlayListener; import com.tencent.rtmp.TXLiveConstants; +import com.tencent.rtmp.TXLivePlayConfig; import com.tencent.rtmp.TXLivePlayer; import com.tencent.rtmp.ui.TXCloudVideoView; @@ -53,6 +55,7 @@ public class V2XLiveGSYVideoView extends RoundLayout { private V2XVoiceCallbackListener v2XVoiceCallbackRefreshListener = new V2XVoiceCallbackListener() { @Override public void onCallback(String command, Intent intent) { + //startHeartLive(mCarLiveInfo); mLoading.setVisibility(VISIBLE); mClLoadError.setVisibility(GONE); if (mCarLiveInfo != null) { @@ -84,6 +87,12 @@ public class V2XLiveGSYVideoView extends RoundLayout { //关键 player 对象与界面 view mLivePlayer.setPlayerView(mTxcVideoView); mLivePlayer.setMute(true); + + TXLivePlayConfig txLivePlayConfig = new TXLivePlayConfig(); + // 增加重试次数 + txLivePlayConfig.setConnectRetryCount(30); + mLivePlayer.setConfig(txLivePlayConfig); + mLivePlayer.enableHardwareDecode(true); mLoading = findViewById(R.id.loading); @@ -130,6 +139,7 @@ public class V2XLiveGSYVideoView extends RoundLayout { .livePush(new V2XRefreshCallback() { @Override public void onSuccess(V2XLivePushVoRes result) { + Logger.e(MODULE_NAME, "从服务端获取最新直播信息:" + GsonUtil.jsonFromObject(result)); mClLoadError.setVisibility(GONE); mClLoadError.setVisibility(GONE); try { @@ -159,45 +169,58 @@ public class V2XLiveGSYVideoView extends RoundLayout { * 播放直播流,且开始心跳 */ private void playLiveVideo(MarkerCarInfo.CarLiveInfo carLiveInfo) { - startHeartLive(carLiveInfo); - if (mLivePlayer != null) { - mLivePlayer.startPlay(carLiveInfo.getVideoUrl(), TXLivePlayer.PLAY_TYPE_LIVE_RTMP); - mLivePlayer.setPlayListener(new ITXLivePlayListener() { - @Override - public void onPlayEvent(int event, Bundle bundle) { - Logger.w(MODULE_NAME, "播放器:onPlayEvent==" + event + "===bundle===" + bundle); - if (event == TXLiveConstants.PLAY_EVT_PLAY_LOADING) { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - } else if (event == TXLiveConstants.PLAY_EVT_PLAY_BEGIN) { - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(GONE); - } else if (event < 0) { - AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("直播获取识别,可以对我说重试", null); - stopLive(mCarLiveInfo); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(VISIBLE); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE, - v2XVoiceCallbackRefreshListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP, - v2XVoiceCallbackRefreshListener); + try { + if (mLivePlayer != null) { + mLivePlayer.startPlay(carLiveInfo.getVideoUrl(), TXLivePlayer.PLAY_TYPE_LIVE_RTMP); + mLivePlayer.setPlayListener(new ITXLivePlayListener() { + @Override + public void onPlayEvent(int event, Bundle bundle) { + Logger.w(MODULE_NAME, + "直播信息= " + GsonUtil.jsonFromObject(carLiveInfo) + + "\n播放器:onPlayEvent==" + event + + "\nbundle===" + bundle); + if (event == TXLiveConstants.PLAY_EVT_PLAY_LOADING) { + mLoading.setVisibility(VISIBLE); + mClLoadError.setVisibility(GONE); + } else if (event == TXLiveConstants.PLAY_EVT_PLAY_BEGIN) { + mLoading.setVisibility(GONE); + mClLoadError.setVisibility(GONE); + } else if (event < 0) { + AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("直播获取失败,可以对我说重试", null); + stopLive(mCarLiveInfo); + mLoading.setVisibility(GONE); + mClLoadError.setVisibility(VISIBLE); + // 注册语音交互 + V2XVoiceManager.INSTANCE + .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE, + v2XVoiceCallbackRefreshListener) + .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP, + v2XVoiceCallbackRefreshListener); + } } - } - @Override - public void onNetStatus(Bundle bundle) { - //Logger.w(MODULE_NAME, "播放器:onNetStatus===bundle===" + bundle); - } - }); + @Override + public void onNetStatus(Bundle bundle) { + Logger.w(MODULE_NAME, "播放器:onNetStatus===bundle===" + bundle); + } + }); + } + } catch (Exception e) { + e.printStackTrace(); + mLoading.setVisibility(GONE); + mClLoadError.setVisibility(VISIBLE); + Logger.e(MODULE_NAME, "直播发生异常:carLiveInfo= " + GsonUtil.jsonFromObject(carLiveInfo)); } } - // 刷新直播心跳 + /** + * 刷新直播心跳 + * + * @param carLiveInfo + */ private void startHeartLive(MarkerCarInfo.CarLiveInfo carLiveInfo) { try { - if (!TextUtils.isEmpty(carLiveInfo.getVideoSn()) + if (carLiveInfo != null && !TextUtils.isEmpty(carLiveInfo.getVideoSn()) && !TextUtils.isEmpty(carLiveInfo.getVideoChannel())) { V2XServiceManager .getV2XRefreshModel()