Merge branch 'live_fixbug' of http://gitlab.zhidaoauto.com/ITC/Apps/MoGoAiCloudSdk into live_fixbug
This commit is contained in:
@@ -107,7 +107,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
* 初始化令牌信息
|
||||
*/
|
||||
private void initPassportInfo() {
|
||||
tvAppKey.setText("AppKey:" + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getThirdPartyDeviceId());
|
||||
tvAppKey.setText("AppKey:" + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getThirdPartyAppKey());
|
||||
tvDevicesId.setText("DevicesId:" + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getThirdPartyDeviceId());
|
||||
|
||||
String sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
|
||||
@@ -43,11 +43,12 @@ public class MoGoApplication extends MultiDexApplication {
|
||||
MoGoAiCloudClientConfig clientConfig = MoGoAiCloudClientConfig.getInstance();
|
||||
// 设置网络环境:HTTP_DNS_ENV_QA、HTTP_DNS_ENV_RELEASE、HTTP_DNS_ENV_DEV
|
||||
clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_QA);
|
||||
|
||||
// 设置是否是第三APP登录,false:自有车机 true:外部三方车机
|
||||
clientConfig.setThirdLogin(true);
|
||||
// 设置是否输出日志
|
||||
clientConfig.setShowDebugLog(true);
|
||||
// 设置是否是直播推流的主播
|
||||
clientConfig.setAnchor(false);
|
||||
// 设置从蘑菇AI开放平台获取的APPKey
|
||||
clientConfig.setThirdPartyAppKey("wbvpzgar");
|
||||
// 设置AI云平台分配给三方应用的签名密钥,需要从AI云平台申请
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="请输入要查看的车机SN"
|
||||
android:text="F803EB2046PZD00149"
|
||||
android:text="F803BB2037EZD00007"
|
||||
android:textColor="#FFFF"
|
||||
app:layout_constraintBottom_toTopOf="@+id/liveToggleBtn"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -480,9 +480,16 @@ public class MoGoLiveManager {
|
||||
*/
|
||||
public synchronized void loginRoom() {
|
||||
// 当前用户ID
|
||||
String userId = mLivePushConfig.getDevicesId();
|
||||
mLiveStatusModel.setCurrentRoomId(ROOM_ID_PREFIX + mLivePushConfig.getDevicesId());
|
||||
mLiveStatusModel.setCurrentStreamId(STREAM_ID_PREFIX + mLivePushConfig.getDevicesId());
|
||||
String userId;
|
||||
if (MoGoAiCloudClientConfig.getInstance().isAnchor()) {
|
||||
// 这里为了方便直接使用原始的车机SN
|
||||
userId = mLivePushConfig.getDevicesId();
|
||||
} else {
|
||||
// 这里对观众添加标记,防止与主播的ID相同,导致踢下线的情况发生
|
||||
userId = "Audience_" + mLivePushConfig.getDevicesId();
|
||||
}
|
||||
mLiveStatusModel.setCurrentRoomId(ROOM_ID_PREFIX + userId);
|
||||
mLiveStatusModel.setCurrentStreamId(STREAM_ID_PREFIX + userId);
|
||||
Logger.i(TAG,
|
||||
"尝试进入自己房间 loginRoom userId : " + userId
|
||||
+ " currentRoomId:" + mLiveStatusModel.getCurrentRoomId()
|
||||
|
||||
@@ -42,7 +42,6 @@ public class PushService extends Service
|
||||
Logger.i(TAG, "初始化推流服务……");
|
||||
if (mLivePusher == null) {
|
||||
mLivePusher = MoGoLiveManager.getInstance();
|
||||
mLivePusher.addLiveRoomStatusListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +97,8 @@ public class PushService extends Service
|
||||
return;
|
||||
}
|
||||
if (mLivePusher != null && !mLivePusher.getLiveStatusModel().isLoginCurrentRoom()) {
|
||||
// 设置登录房间的回调监听
|
||||
mLivePusher.addLiveRoomStatusListener(this);
|
||||
// 推流之前必须先登录房间
|
||||
mLivePusher.loginRoom();
|
||||
} else {
|
||||
@@ -118,6 +119,8 @@ public class PushService extends Service
|
||||
*/
|
||||
private void stopPush() {
|
||||
try {
|
||||
// 移除登录房间回调
|
||||
mLivePusher.removeLiveRoomStatusListener(this);
|
||||
// 是否处于发布状态
|
||||
if (mLivePusher != null && mLivePusher.getLiveStatusModel().isPushing()) {
|
||||
// 停止发布
|
||||
|
||||
@@ -62,6 +62,12 @@ public class MoGoAiCloudClientConfig {
|
||||
*/
|
||||
private boolean isShowDebugLog = true;
|
||||
|
||||
/**
|
||||
* 因为ZeGo的房间限制,这里需要区分出,SDK提供给的是观众还是主播
|
||||
* true-主播,false-观众
|
||||
*/
|
||||
private boolean isAnchor = true;
|
||||
|
||||
/**
|
||||
* 服务器分配给应用的令牌,用于网络请求校验
|
||||
*/
|
||||
@@ -350,6 +356,22 @@ public class MoGoAiCloudClientConfig {
|
||||
mServiceAppId = serviceAppId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true-主播,false-观众
|
||||
*/
|
||||
public boolean isAnchor() {
|
||||
return isAnchor;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否是主播
|
||||
*
|
||||
* @param anchor true-主播,false-观众
|
||||
*/
|
||||
public void setAnchor(boolean anchor) {
|
||||
isAnchor = anchor;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回HttpDns的位置信息,必须设置,否则将无法使用网络请求
|
||||
*
|
||||
|
||||
@@ -27,23 +27,23 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
|
||||
USERNAME=xintai
|
||||
PASSWORD=xintai2018
|
||||
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
|
||||
RELEASE=false
|
||||
RELEASE=true
|
||||
# AI CLOUD 云平台
|
||||
# 工具类
|
||||
MOGO_UTILS_VERSION=1.0.57
|
||||
MOGO_UTILS_VERSION=1.0.58
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.0.57
|
||||
MOGO_NETWORK_VERSION=1.0.58
|
||||
# 网络DNS
|
||||
MOGO_HTTPDNS_VERSION=1.0.57
|
||||
MOGO_HTTPDNS_VERSION=1.0.58
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.0.57
|
||||
MOGO_PASSPORT_VERSION=1.0.58
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.0.57
|
||||
MOGO_SOCKET_VERSION=1.0.58
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.0.58
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.0.57
|
||||
MOGO_TANLU_VERSION=1.0.58
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.0.57
|
||||
MOGO_LIVE_VERSION=1.0.58
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.0.57
|
||||
MOGO_TRAFFICLIVE_VERSION=1.0.58
|
||||
|
||||
Reference in New Issue
Block a user