From 3f42b0b1904150340d7ba71510244dfa412b4e94 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Thu, 11 Nov 2021 21:31:40 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E5=B8=A7=E7=94=BB=E9=9D=A2=E5=92=8C=E9=94=99=E8=AF=AF=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E5=9B=9E=E8=B0=83=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/cloud/LivePlayAndPushActivity.java | 7 +++ .../java/com/mogo/cloud/MainActivity.java | 15 ++++++ .../java/com/mogo/cloud/MoGoApplication.java | 4 +- .../layout/activity_live_play_and_push.xml | 4 +- .../listener/IMediaPlayerStateListener.java | 21 ++++++++ .../cloud/live/manager/MoGoLiveManager.java | 50 +++++++++++++++++++ .../api/ITrafficCarLiveCallBack.java | 4 ++ .../core/TrafficLiveCurrentManager.java | 30 +++++++++++ 8 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 foudations/mogo-live/src/main/java/com/mogo/cloud/live/listener/IMediaPlayerStateListener.java diff --git a/app/src/main/java/com/mogo/cloud/LivePlayAndPushActivity.java b/app/src/main/java/com/mogo/cloud/LivePlayAndPushActivity.java index 06b4c28..18c0a6d 100644 --- a/app/src/main/java/com/mogo/cloud/LivePlayAndPushActivity.java +++ b/app/src/main/java/com/mogo/cloud/LivePlayAndPushActivity.java @@ -3,6 +3,7 @@ package com.mogo.cloud; import android.net.wifi.WifiInfo; import android.os.Bundle; import android.util.Log; +import android.view.View; import com.mogo.cloud.live.listener.ILiveStatusListener; import com.mogo.cloud.live.manager.LiveStreamManagerImpl; @@ -124,6 +125,12 @@ public class LivePlayAndPushActivity extends BaseLiveActivity Logger.d(TAG, "开始直播 onLive"); } + @Override + public void onFirstFrame() { + surfacePlayView.setVisibility(View.VISIBLE); + Logger.d(TAG, "onFirstFrame"); + } + @Override public void onDisConnect() { Logger.d(TAG, "失去连接 onDisConnect"); diff --git a/app/src/main/java/com/mogo/cloud/MainActivity.java b/app/src/main/java/com/mogo/cloud/MainActivity.java index 61ef037..4471031 100644 --- a/app/src/main/java/com/mogo/cloud/MainActivity.java +++ b/app/src/main/java/com/mogo/cloud/MainActivity.java @@ -152,11 +152,26 @@ public class MainActivity extends AppCompatActivity { MoGoAiCloudTrafficLive.viewFrontVehicleLive(40.11547, 116.22544, 60, surfacePreviewView, new ITrafficCarLiveCallBack() { + @Override + public void onLiveConnecting() { + + } + + @Override + public void onLiveConnected() { + + } + @Override public void onLive(String liveSn) { Logger.e(TAG, "liveSn : " + liveSn); } + @Override + public void onFirstFrame() { + Logger.e(TAG, "onFirstFrame"); + } + @Override public void onDisConnect() { Logger.e(TAG, "onDisConnect"); diff --git a/app/src/main/java/com/mogo/cloud/MoGoApplication.java b/app/src/main/java/com/mogo/cloud/MoGoApplication.java index bde40ca..39b539c 100644 --- a/app/src/main/java/com/mogo/cloud/MoGoApplication.java +++ b/app/src/main/java/com/mogo/cloud/MoGoApplication.java @@ -46,7 +46,7 @@ public class MoGoApplication extends MultiDexApplication { // 配置云服务API MoGoAiCloudClientConfig clientConfig = MoGoAiCloudClientConfig.getInstance(); // 设置网络环境:HTTP_DNS_ENV_QA、HTTP_DNS_ENV_RELEASE、HTTP_DNS_ENV_DEV - clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_RELEASE); + clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_QA); // 设置是否是第三APP登录,false:自有车机 true:外部三方车机 clientConfig.setThirdLogin(true); // 设置是否输出日志 @@ -58,7 +58,7 @@ public class MoGoApplication extends MultiDexApplication { // 设置AI云平台分配给三方应用的签名密钥,需要从AI云平台申请 // 设置车机设备的唯一标识(这些表识必须是通过后台录入的设备) // TODO 这里使用的是测试的sn - clientConfig.setThirdPartyDeviceId("B95ACB94DF240C89"); + clientConfig.setThirdPartyDeviceId("C95ACB94DF240C89"); // 设置应用服务AppId 长链、鉴权 //todo 需要卸载智慧驾驶、行车记录仪 clientConfig.setServiceAppId("com.mogo.launcher"); // 设置循环检测间隔时间 diff --git a/app/src/main/res/layout/activity_live_play_and_push.xml b/app/src/main/res/layout/activity_live_play_and_push.xml index a01bac8..624a6bc 100644 --- a/app/src/main/res/layout/activity_live_play_and_push.xml +++ b/app/src/main/res/layout/activity_live_play_and_push.xml @@ -23,7 +23,9 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/surfacePreviewView" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + android:visibility="invisible" + /> Date: Wed, 24 Nov 2021 16:39:40 +0800 Subject: [PATCH 2/5] =?UTF-8?q?[Change]=E4=BF=AE=E6=94=B9=E6=8E=A8?= =?UTF-8?q?=E6=B5=81=E6=B5=81=E7=A8=8B=EF=BC=8C=E5=8E=9F=E5=9B=A0=E6=98=AF?= =?UTF-8?q?=E8=A1=A1=E9=98=B3=E7=8E=AF=E5=A2=83=E4=B8=ADSocket=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=E6=8C=87=E4=BB=A4=E6=9C=89=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E6=94=B9=E6=88=90=E4=BA=86=E5=80=9F=E7=94=A8?= =?UTF-8?q?ZeGo=E7=9A=84=E6=88=BF=E9=97=B4=E4=BA=BA=E6=95=B0=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E5=A4=A7=E4=BA=8E1=E4=BA=BA=E5=BC=80=E5=A7=8B?= =?UTF-8?q?=E7=9B=B4=E6=92=AD=EF=BC=8C=E5=90=A6=E5=88=99=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E7=9B=B4=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/deploymentTargetDropDown.xml | 17 +++++++++++++++++ .idea/misc.xml | 6 +++++- .../java/com/mogo/cloud/MoGoApplication.java | 4 ++-- .../res/layout/activity_live_play_and_push.xml | 2 +- .../live/manager/LiveStreamManagerImpl.java | 4 +++- .../cloud/live/manager/MoGoLiveManager.java | 18 +++++++++++------- .../mogo/cloud/live/server/PushService.java | 4 ++-- gradle.properties | 2 +- 8 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 .idea/deploymentTargetDropDown.xml diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..c945303 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index daa7ca6..53f5d92 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -11,9 +11,13 @@ diff --git a/app/src/main/java/com/mogo/cloud/MoGoApplication.java b/app/src/main/java/com/mogo/cloud/MoGoApplication.java index 39b539c..ab52fa4 100644 --- a/app/src/main/java/com/mogo/cloud/MoGoApplication.java +++ b/app/src/main/java/com/mogo/cloud/MoGoApplication.java @@ -46,12 +46,12 @@ public class MoGoApplication extends MultiDexApplication { // 配置云服务API MoGoAiCloudClientConfig clientConfig = MoGoAiCloudClientConfig.getInstance(); // 设置网络环境:HTTP_DNS_ENV_QA、HTTP_DNS_ENV_RELEASE、HTTP_DNS_ENV_DEV - clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_QA); + clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_RELEASE); // 设置是否是第三APP登录,false:自有车机 true:外部三方车机 clientConfig.setThirdLogin(true); // 设置是否输出日志 clientConfig.setShowDebugLog(true); - // 设置是否是直播推流的主播 + // 设置是否是直播推流的主播 true-主播,false-观众 clientConfig.setAnchor(false); // 设置从蘑菇AI开放平台获取的APPKey clientConfig.setThirdPartyAppKey("pfieouqg"); diff --git a/app/src/main/res/layout/activity_live_play_and_push.xml b/app/src/main/res/layout/activity_live_play_and_push.xml index 624a6bc..7047d9f 100644 --- a/app/src/main/res/layout/activity_live_play_and_push.xml +++ b/app/src/main/res/layout/activity_live_play_and_push.xml @@ -106,7 +106,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:hint="请输入要查看的车机SN" - android:text="F803EB2046PZD00188" + android:text="202111243VN62KQ" android:textColor="#FFFF" app:layout_constraintBottom_toTopOf="@+id/liveToggleBtn" app:layout_constraintEnd_toEndOf="parent" diff --git a/foudations/mogo-live/src/main/java/com/mogo/cloud/live/manager/LiveStreamManagerImpl.java b/foudations/mogo-live/src/main/java/com/mogo/cloud/live/manager/LiveStreamManagerImpl.java index eb5eee6..05d120c 100644 --- a/foudations/mogo-live/src/main/java/com/mogo/cloud/live/manager/LiveStreamManagerImpl.java +++ b/foudations/mogo-live/src/main/java/com/mogo/cloud/live/manager/LiveStreamManagerImpl.java @@ -205,7 +205,7 @@ public class LiveStreamManagerImpl implements ILiveStreamManager { }; /** - * + * 房间在线人数检测,1=只有自己需要关闭推流,>1 代表有观众在观看需要开启推流 */ private final Runnable mOnlineNumRun = () -> { // 判断当前观众的个数,如果没人观看了的情况则停止直播 @@ -215,6 +215,8 @@ public class LiveStreamManagerImpl implements ILiveStreamManager { if (mLivePusher.getLiveStatusModel().isPushing() && mLivePusher.getLiveStatusModel().getOnlineNumber() <= 1) { livePushHandler(PUSH_STOP, C1); + } else { + livePushHandler(PUSH_START, C1); } restartCheckOnlineNumLoop(); }; diff --git a/foudations/mogo-live/src/main/java/com/mogo/cloud/live/manager/MoGoLiveManager.java b/foudations/mogo-live/src/main/java/com/mogo/cloud/live/manager/MoGoLiveManager.java index 5fc1042..9ffe086 100644 --- a/foudations/mogo-live/src/main/java/com/mogo/cloud/live/manager/MoGoLiveManager.java +++ b/foudations/mogo-live/src/main/java/com/mogo/cloud/live/manager/MoGoLiveManager.java @@ -12,6 +12,7 @@ import com.mogo.cloud.live.listener.ILiveRoomPersonListener; import com.mogo.cloud.live.listener.ILiveStatusListener; import com.mogo.cloud.live.listener.IMediaPlayerStateListener; import com.mogo.cloud.live.model.LiveStatusModel; +import com.mogo.cloud.live.server.PushService; import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import org.json.JSONObject; @@ -261,7 +262,9 @@ public class MoGoLiveManager { if (mLiveStatusModel.getCurrentRoomId().equals(roomID)) { // 更新真实的在线人数 mLiveStatusModel.setOnlineNumber(count); - + if (count > 2) { + PushService.startService(mApplication, PushService.ACTION_START_RTMP_PUSH); + } Log.i(TAG, "房间内当前在线用户数量回调 onRoomOnlineUserCountUpdate roomID : " + roomID + " , online user number : " + mLiveStatusModel.getOnlineNumber()); if (mRoomPersonListener != null) { @@ -307,12 +310,12 @@ public class MoGoLiveManager { " , state : " + state.name() + " , errorCode : " + errorCode); - // 判断如果处于非播放和非推流状态则进行登出操作,并释放引擎 - if (!mLiveStatusModel.isPlaying() - && !mLiveStatusModel.isPushing() - && mLiveStatusModel.getOnlineNumber() <= 1) { - logoutCurrentRoom(); - } +// // 判断如果处于非播放和非推流状态则进行登出操作,并释放引擎 +// if (!mLiveStatusModel.isPlaying() +// && !mLiveStatusModel.isPushing() +// && mLiveStatusModel.getOnlineNumber() <= 1) { +// logoutCurrentRoom(); +// } if (mLiveStatusListener != null) { mLiveStatusListener.onChange(mLiveStatusModel.isPushing() ? 0 : 1); @@ -487,6 +490,7 @@ public class MoGoLiveManager { mExpressEngine.setVideoConfig(zegoVideoConfig); } initCustomVideoCapture(); + loginRoom(); } /** diff --git a/foudations/mogo-live/src/main/java/com/mogo/cloud/live/server/PushService.java b/foudations/mogo-live/src/main/java/com/mogo/cloud/live/server/PushService.java index acd7db6..a0f5881 100644 --- a/foudations/mogo-live/src/main/java/com/mogo/cloud/live/server/PushService.java +++ b/foudations/mogo-live/src/main/java/com/mogo/cloud/live/server/PushService.java @@ -100,7 +100,7 @@ public class PushService extends Service // 设置登录房间的回调监听 mLivePusher.addLiveRoomStatusListener(this); // 推流之前必须先登录房间 - mLivePusher.loginRoom(); + //mLivePusher.loginRoom(); } else { realStartPublish(); } @@ -126,7 +126,7 @@ public class PushService extends Service // 停止发布 mLivePusher.stopPublish(); // 退出房间 - mLivePusher.logoutCurrentRoom(); + //mLivePusher.logoutCurrentRoom(); } // 移除视频回碉监听 CameraFrameManager.getInstance().rmYuvDataCallback(this); diff --git a/gradle.properties b/gradle.properties index 1e468c4..a611f40 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,7 +27,7 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/ USERNAME=xintai PASSWORD=xintai2018 # 编译模式: false - 依赖本地版本, true - 依赖 maven 版本 -RELEASE=true +RELEASE=false # AI CLOUD 云平台 # 工具类 MOGO_UTILS_VERSION=1.1.55-live From 2cc71fb0eb9a368406a8d172bebf136bf7ac3503 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Wed, 24 Nov 2021 16:56:11 +0800 Subject: [PATCH 3/5] =?UTF-8?q?[Upload]=E4=B8=8A=E4=BC=A0maven=201.1.58-li?= =?UTF-8?q?ve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/git_toolbox_prj.xml | 15 +++++++++++++++ gradle.properties | 20 ++++++++++---------- upload.sh | 4 ++-- 3 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 .idea/git_toolbox_prj.xml diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 0000000..b382006 --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index a611f40..87c5bfa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -30,22 +30,22 @@ PASSWORD=xintai2018 RELEASE=false # AI CLOUD 云平台 # 工具类 -MOGO_UTILS_VERSION=1.1.55-live +MOGO_UTILS_VERSION=1.1.58-live # 网络请求 -MOGO_NETWORK_VERSION=1.1.55-live +MOGO_NETWORK_VERSION=1.1.58-live # 网络DNS -MOGO_HTTPDNS_VERSION=1.1.55-live +MOGO_HTTPDNS_VERSION=1.1.58-live # 鉴权 -MOGO_PASSPORT_VERSION=1.1.55-live +MOGO_PASSPORT_VERSION=1.1.58-live # 常链接 -MOGO_SOCKET_VERSION=1.1.55-live +MOGO_SOCKET_VERSION=1.1.58-live # 数据采集 -MOGO_REALTIME_VERSION=1.1.55-live +MOGO_REALTIME_VERSION=1.1.58-live # 探路,道路事件发布,获取 -MOGO_TANLU_VERSION=1.1.55-live +MOGO_TANLU_VERSION=1.1.58-live # 直播推流 -MOGO_LIVE_VERSION=1.1.55-live +MOGO_LIVE_VERSION=1.1.58-live # 直播拉流 -MOGO_TRAFFICLIVE_VERSION=1.1.55-live +MOGO_TRAFFICLIVE_VERSION=1.1.58-live # 定位服务 -MOGO_LOCATION_VERSION=1.1.55-live +MOGO_LOCATION_VERSION=1.1.58-live diff --git a/upload.sh b/upload.sh index c835c8b..4049f34 100755 --- a/upload.sh +++ b/upload.sh @@ -1,5 +1,4 @@ #!/bin/bash - function upload(){ ./gradlew $1:clean $1:uploadArchives if [ $? -ne 0 ];then exit; fi @@ -8,4 +7,5 @@ function upload(){ for module in `cat modules.txt`; do upload $module -done \ No newline at end of file +done +echo -e "\033[32m 恭喜你完成了所有MoGo模块上传 \033[0m" \ No newline at end of file From 118696dcafd75d9674dbe55e3e0d695f990c7044 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Wed, 24 Nov 2021 17:37:32 +0800 Subject: [PATCH 4/5] =?UTF-8?q?[Upload=E4=BF=AE=E6=94=B9=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E8=BD=A6=E6=9C=BASN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/deploymentTargetDropDown.xml | 17 ----------------- .../res/layout/activity_live_play_and_push.xml | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 .idea/deploymentTargetDropDown.xml diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml deleted file mode 100644 index c945303..0000000 --- a/.idea/deploymentTargetDropDown.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_live_play_and_push.xml b/app/src/main/res/layout/activity_live_play_and_push.xml index 7047d9f..2251c7a 100644 --- a/app/src/main/res/layout/activity_live_play_and_push.xml +++ b/app/src/main/res/layout/activity_live_play_and_push.xml @@ -106,7 +106,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:hint="请输入要查看的车机SN" - android:text="202111243VN62KQ" + android:text="F803BB2037EZD00088" android:textColor="#FFFF" app:layout_constraintBottom_toTopOf="@+id/liveToggleBtn" app:layout_constraintEnd_toEndOf="parent" From b2da61cabee74543552774f2c8eecd6e2629f3e6 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Wed, 24 Nov 2021 17:38:07 +0800 Subject: [PATCH 5/5] =?UTF-8?q?[Upload=E4=BF=AE=E6=94=B9=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E8=BD=A6=E6=9C=BASN=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_live_play_and_push.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/activity_live_play_and_push.xml b/app/src/main/res/layout/activity_live_play_and_push.xml index 2251c7a..9cf7ca0 100644 --- a/app/src/main/res/layout/activity_live_play_and_push.xml +++ b/app/src/main/res/layout/activity_live_play_and_push.xml @@ -107,7 +107,7 @@ android:layout_height="wrap_content" android:hint="请输入要查看的车机SN" android:text="F803BB2037EZD00088" - android:textColor="#FFFF" + android:textColor="#000" app:layout_constraintBottom_toTopOf="@+id/liveToggleBtn" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@+id/surfacePlayView" />