[Change]修改推流流程,原因是衡阳环境中Socket下发指令有问题,现在改成了借用ZeGo的房间人数流程大于1人开始直播,否则关闭直播
This commit is contained in:
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="HA1C6T8C" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2021-11-24T08:34:04.958113Z" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/misc.xml
generated
6
.idea/misc.xml
generated
@@ -11,9 +11,13 @@
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="app/src/main/res/layout/activity_live_play_and_push.xml" value="0.1" />
|
||||
<entry key="app/src/main/res/layout/actitity_config_info.xml" value="0.35260416666666666" />
|
||||
<entry key="app/src/main/res/layout/activity_live_play_and_push.xml" value="0.25" />
|
||||
<entry key="app/src/main/res/layout/activity_live_push.xml" value="0.3640625" />
|
||||
<entry key="app/src/main/res/layout/activity_location.xml" value="0.36502448356535333" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.3640625" />
|
||||
<entry key="app/src/main/res/layout/activity_real_time.xml" value="0.1609347442680776" />
|
||||
<entry key="app/src/main/res/xml/network_security_config.xml" value="0.23854166666666668" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user