Merge branch 'fix_loginMultiRoom_bug'
# Conflicts: # app/src/main/java/com/mogo/cloud/MoGoApplication.java # gradle.properties
This commit is contained in:
@@ -54,7 +54,7 @@ public class MoGoApplication extends MultiDexApplication {
|
||||
clientConfig.setThirdLogin(true);
|
||||
// 设置是否输出日志
|
||||
clientConfig.setShowDebugLog(true);
|
||||
// 设置是否是直播推流的主播
|
||||
// 设置是否是直播推流的主播 true-主播,false-观众
|
||||
clientConfig.setAnchor(false);
|
||||
// 设置从蘑菇AI开放平台获取的APPKey
|
||||
clientConfig.setThirdPartyAppKey("pfieouqg");
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user