Merge branch 'fix_loginMultiRoom_bug'
# Conflicts: # app/src/main/java/com/mogo/cloud/LivePlayActivity.java # app/src/main/java/com/mogo/cloud/MoGoApplication.java # app/src/main/res/layout/activity_live_play.xml # foudations/mogo-live/src/main/java/com/mogo/cloud/live/manager/RequestLiveManager.java # gradle.properties
This commit is contained in:
@@ -21,42 +21,107 @@ import com.mogo.cloud.wifi.WifiStateManager;
|
||||
|
||||
public class LivePlayActivity extends AppCompatActivity implements ITrafficCarLiveCallBack, IWifiStateListener {
|
||||
private String TAG = "LiveActivity";
|
||||
|
||||
private SurfaceView surfaceView;
|
||||
private ToggleButton liveToggleBtn;
|
||||
private EditText etLookRoomId;
|
||||
private TextView tvWifiState;
|
||||
private String liveSn;
|
||||
|
||||
private SurfaceView surfaceView0;
|
||||
private ToggleButton liveToggleBtn0;
|
||||
private EditText etLookRoomId0;
|
||||
private String liveSn0;
|
||||
|
||||
private SurfaceView surfaceView1;
|
||||
private ToggleButton liveToggleBtn1;
|
||||
private EditText etLookRoomId1;
|
||||
private String liveSn1;
|
||||
|
||||
private SurfaceView surfaceView2;
|
||||
private ToggleButton liveToggleBtn2;
|
||||
private EditText etLookRoomId2;
|
||||
private String liveSn2;
|
||||
|
||||
private SurfaceView surfaceView3;
|
||||
private ToggleButton liveToggleBtn3;
|
||||
private EditText etLookRoomId3;
|
||||
private String liveSn3;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_live_play);
|
||||
surfaceView = findViewById(R.id.surfaceView);
|
||||
etLookRoomId = findViewById(R.id.etLookRoomId);
|
||||
liveToggleBtn = findViewById(R.id.liveToggleBtn);
|
||||
tvWifiState = findViewById(R.id.tvWifiState);
|
||||
|
||||
LiveStreamManagerImpl.getInstance(this.getApplication(),
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(),false);
|
||||
liveToggleBtn.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), false);
|
||||
tvWifiState = findViewById(R.id.tvWifiState);
|
||||
|
||||
surfaceView0 = findViewById(R.id.surfaceView0);
|
||||
etLookRoomId0 = findViewById(R.id.etLookRoomId0);
|
||||
liveToggleBtn0 = findViewById(R.id.liveToggleBtn0);
|
||||
|
||||
liveToggleBtn0.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
Toast.makeText(getApplicationContext(), buttonView.getText(), Toast.LENGTH_SHORT).show();
|
||||
if (isChecked) {
|
||||
liveSn = etLookRoomId.getText().toString().trim();
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(liveSn, surfaceView, this);
|
||||
//just for test
|
||||
liveSn0 = etLookRoomId0.getText().toString().trim();
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(liveSn0, surfaceView0, this);
|
||||
// MoGoAiCloudTrafficLive.viewFrontVehicleLive(39.968253, 116.410829, 0, surfaceView, this);
|
||||
} else {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn);
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn0);
|
||||
}
|
||||
});
|
||||
|
||||
surfaceView1 = findViewById(R.id.surfaceView1);
|
||||
etLookRoomId1 = findViewById(R.id.etLookRoomId1);
|
||||
liveToggleBtn1 = findViewById(R.id.liveToggleBtn1);
|
||||
|
||||
liveToggleBtn1.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
Toast.makeText(getApplicationContext(), buttonView.getText(), Toast.LENGTH_SHORT).show();
|
||||
if (isChecked) {
|
||||
liveSn1 = etLookRoomId1.getText().toString().trim();
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(liveSn1, surfaceView1, this);
|
||||
// MoGoAiCloudTrafficLive.viewFrontVehicleLive(39.968253, 116.410829, 0, surfaceView, this);
|
||||
} else {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn1);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
surfaceView2 = findViewById(R.id.surfaceView2);
|
||||
etLookRoomId2 = findViewById(R.id.etLookRoomId2);
|
||||
liveToggleBtn2 = findViewById(R.id.liveToggleBtn2);
|
||||
|
||||
liveToggleBtn2.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
Toast.makeText(getApplicationContext(), buttonView.getText(), Toast.LENGTH_SHORT).show();
|
||||
if (isChecked) {
|
||||
liveSn2 = etLookRoomId2.getText().toString().trim();
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(liveSn2, surfaceView2, this);
|
||||
// MoGoAiCloudTrafficLive.viewFrontVehicleLive(39.968253, 116.410829, 0, surfaceView, this);
|
||||
} else {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn2);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
surfaceView3 = findViewById(R.id.surfaceView3);
|
||||
etLookRoomId3 = findViewById(R.id.etLookRoomId3);
|
||||
liveToggleBtn3 = findViewById(R.id.liveToggleBtn3);
|
||||
|
||||
liveToggleBtn3.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
Toast.makeText(getApplicationContext(), buttonView.getText(), Toast.LENGTH_SHORT).show();
|
||||
if (isChecked) {
|
||||
liveSn3 = etLookRoomId3.getText().toString().trim();
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(liveSn3, surfaceView3, this);
|
||||
// MoGoAiCloudTrafficLive.viewFrontVehicleLive(39.968253, 116.410829, 0, surfaceView, this);
|
||||
} else {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn3);
|
||||
}
|
||||
});
|
||||
|
||||
WifiStateManager.getInstance().registerWifiStateListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn);
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn0);
|
||||
WifiStateManager.getInstance().unRegisterWifiStateListener(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class LivePlayAndPushActivity extends BaseLiveActivity
|
||||
liveSn = etLookRoomId.getText().toString().trim();
|
||||
liveStreamManager.getMoGoLiveManager().loginMultiRoom(liveSn);
|
||||
} else {
|
||||
liveStreamManager.getMoGoLiveManager().logoutMultiRoom();
|
||||
liveStreamManager.getMoGoLiveManager().logoutMultiRoom(liveSn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +1,178 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surfaceView"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etLookRoomId"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="请输入要查看的车机SN"
|
||||
android:text="F803EB2046PZD00149"
|
||||
android:textColor="#FFFF"
|
||||
app:layout_constraintBottom_toTopOf="@+id/liveToggleBtn"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surfaceView0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
tools:layout_editor_absoluteX="0dp"
|
||||
tools:layout_editor_absoluteY="0dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etLookRoomId0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="请输入要查看的车机SN"
|
||||
android:text="F803EB2046PZD00274"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/liveToggleBtn0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="开始拉流"
|
||||
android:textOn="停止拉流"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surfaceView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etLookRoomId1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="请输入要查看的车机SN"
|
||||
android:text="F803EB2046PZD00188"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/liveToggleBtn1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="开始拉流"
|
||||
android:textOn="停止拉流"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surfaceView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
tools:layout_editor_absoluteX="0dp"
|
||||
tools:layout_editor_absoluteY="0dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etLookRoomId2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="请输入要查看的车机SN"
|
||||
android:text="F803EB2046PZD00149"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/liveToggleBtn2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="开始拉流"
|
||||
android:textOn="停止拉流"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surfaceView3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etLookRoomId3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="请输入要查看的车机SN"
|
||||
android:text="F803EB2046PZD00167"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/liveToggleBtn3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="开始拉流"
|
||||
android:textOn="停止拉流"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/liveToggleBtn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="开始拉流"
|
||||
android:textOn="停止拉流"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvWifiState"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="wifi State :0"
|
||||
android:textColor="#17FBF4"
|
||||
android:textSize="32px"
|
||||
android:text="wifi State :0"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
</LinearLayout>
|
||||
1
foudations/mogo-live/libs/VERSION.txt
Normal file
1
foudations/mogo-live/libs/VERSION.txt
Normal file
@@ -0,0 +1 @@
|
||||
2.14.0.5551_stable_video
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
foudations/mogo-live/libs/x86/libZegoExpressEngine.so
Executable file
BIN
foudations/mogo-live/libs/x86/libZegoExpressEngine.so
Executable file
Binary file not shown.
BIN
foudations/mogo-live/libs/x86_64/libZegoExpressEngine.so
Executable file
BIN
foudations/mogo-live/libs/x86_64/libZegoExpressEngine.so
Executable file
Binary file not shown.
@@ -32,11 +32,11 @@ import im.zego.zegoexpress.ZegoExpressEngine;
|
||||
import im.zego.zegoexpress.callback.IZegoCustomVideoCaptureHandler;
|
||||
import im.zego.zegoexpress.callback.IZegoEventHandler;
|
||||
import im.zego.zegoexpress.constants.ZegoEngineState;
|
||||
import im.zego.zegoexpress.constants.ZegoLanguage;
|
||||
import im.zego.zegoexpress.constants.ZegoPlayerState;
|
||||
import im.zego.zegoexpress.constants.ZegoPublishChannel;
|
||||
import im.zego.zegoexpress.constants.ZegoPublisherState;
|
||||
import im.zego.zegoexpress.constants.ZegoRemoteDeviceState;
|
||||
import im.zego.zegoexpress.constants.ZegoRoomMode;
|
||||
import im.zego.zegoexpress.constants.ZegoRoomState;
|
||||
import im.zego.zegoexpress.constants.ZegoScenario;
|
||||
import im.zego.zegoexpress.constants.ZegoUpdateType;
|
||||
@@ -47,6 +47,9 @@ import im.zego.zegoexpress.constants.ZegoVideoFrameFormat;
|
||||
import im.zego.zegoexpress.constants.ZegoViewMode;
|
||||
import im.zego.zegoexpress.entity.ZegoCanvas;
|
||||
import im.zego.zegoexpress.entity.ZegoCustomVideoCaptureConfig;
|
||||
import im.zego.zegoexpress.entity.ZegoEngineConfig;
|
||||
import im.zego.zegoexpress.entity.ZegoEngineProfile;
|
||||
import im.zego.zegoexpress.entity.ZegoPlayerConfig;
|
||||
import im.zego.zegoexpress.entity.ZegoRoomConfig;
|
||||
import im.zego.zegoexpress.entity.ZegoUser;
|
||||
import im.zego.zegoexpress.entity.ZegoVideoConfig;
|
||||
@@ -123,6 +126,7 @@ public class MoGoLiveManager {
|
||||
*/
|
||||
private final ZegoRoomConfig zeGoRoomConfig;
|
||||
private IMediaPlayerStateListener mMediaPlayerStateListener;
|
||||
private ZegoUser zegoUserCurrent;
|
||||
|
||||
private static final class Holder {
|
||||
private static final MoGoLiveManager manager = new MoGoLiveManager();
|
||||
@@ -182,8 +186,11 @@ public class MoGoLiveManager {
|
||||
for (ILiveProgressListener iLiveProgressListener : mProgressListener) {
|
||||
iLiveProgressListener.onDebugError(errorCode, funcName, info);
|
||||
}
|
||||
// 停止推送数据
|
||||
stopPublish();
|
||||
// 是否处于发布状态
|
||||
if (mLiveStatusModel != null && mLiveStatusModel.isPushing()) {
|
||||
// 停止推送数据
|
||||
stopPublish();
|
||||
}
|
||||
}
|
||||
|
||||
// 音视频引擎状态更新回调
|
||||
@@ -466,15 +473,36 @@ public class MoGoLiveManager {
|
||||
case HTTP_DNS_ENV_DEMO:
|
||||
isTestEnv = false;
|
||||
}
|
||||
mExpressEngine = ZegoExpressEngine.createEngine(
|
||||
appId,
|
||||
appKey,
|
||||
isTestEnv,
|
||||
ZegoScenario.GENERAL,
|
||||
mApplication,
|
||||
mEventHandler);
|
||||
|
||||
// 设置房间模式为多房间模式
|
||||
ZegoExpressEngine.setRoomMode(ZegoRoomMode.MULTI_ROOM);
|
||||
|
||||
ZegoEngineConfig zegoEngineConfig = new ZegoEngineConfig();
|
||||
zegoEngineConfig.advancedConfig.put("language", "chinese");
|
||||
zegoEngineConfig.advancedConfig.put("set_verbose", MoGoAiCloudClientConfig.getInstance().isShowDebugLog() + "");
|
||||
ZegoExpressEngine.setEngineConfig(zegoEngineConfig);
|
||||
|
||||
ZegoEngineProfile profile = new ZegoEngineProfile();
|
||||
/* 请通过官网注册获取,格式为 123456789L */
|
||||
profile.appID = appId;
|
||||
/* 64个字符,请通过官网注册获取,格式为"0123456789012345678901234567890123456789012345678901234567890123" */
|
||||
profile.appSign = appKey;
|
||||
/* 通用场景接入 */
|
||||
profile.scenario = ZegoScenario.GENERAL;
|
||||
/* 设置app的application 对象 */
|
||||
profile.application = mApplication;
|
||||
/* 创建引擎 */
|
||||
mExpressEngine = ZegoExpressEngine.createEngine(profile, mEventHandler);
|
||||
|
||||
// mExpressEngine = ZegoExpressEngine.createEngine(
|
||||
// appId,
|
||||
// appKey,
|
||||
// isTestEnv,
|
||||
// ZegoScenario.GENERAL,
|
||||
// mApplication,
|
||||
// mEventHandler);
|
||||
// 关闭日志
|
||||
mExpressEngine.setDebugVerbose(MoGoAiCloudClientConfig.getInstance().isShowDebugLog(), ZegoLanguage.CHINESE);
|
||||
//mExpressEngine.setDebugVerbose(MoGoAiCloudClientConfig.getInstance().isShowDebugLog(), ZegoLanguage.CHINESE);
|
||||
// true 表示静音(关闭)
|
||||
mExpressEngine.muteMicrophone(true);
|
||||
if (mLivePushConfig != null) {
|
||||
@@ -549,8 +577,8 @@ public class MoGoLiveManager {
|
||||
+ " currentRoomId:" + mLiveStatusModel.getCurrentRoomId()
|
||||
+ " currentStreamId:" + mLiveStatusModel.getCurrentStreamId());
|
||||
if (!mLiveStatusModel.isLoginCurrentRoom()) {
|
||||
ZegoUser zegoUser = new ZegoUser(userId, NAME_PREFIX + userId);
|
||||
mExpressEngine.loginRoom(mLiveStatusModel.getCurrentRoomId(), zegoUser, zeGoRoomConfig);
|
||||
zegoUserCurrent = new ZegoUser(userId, NAME_PREFIX + userId);
|
||||
mExpressEngine.loginRoom(mLiveStatusModel.getCurrentRoomId(), zegoUserCurrent, zeGoRoomConfig);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,26 +617,26 @@ public class MoGoLiveManager {
|
||||
Log.i(TAG,
|
||||
"尝试进入多房间 loginMultiRoom multiRoomId : " + mLiveStatusModel.getMultiRoomId()
|
||||
+ " currentStreamId : " + mLiveStatusModel.getMultiStreamId());
|
||||
if (!mLiveStatusModel.isLoginMultiRoom()) {
|
||||
Log.i(TAG, "执行登录多房间");
|
||||
mExpressEngine.loginMultiRoom(mLiveStatusModel.getMultiRoomId(), zeGoRoomConfig);
|
||||
} else {
|
||||
Log.w(TAG, "已经登录了多房间");
|
||||
}
|
||||
// if (!mLiveStatusModel.isLoginMultiRoom()) {
|
||||
Log.i(TAG, "执行登录多房间");
|
||||
mExpressEngine.loginRoom(mLiveStatusModel.getMultiRoomId(), zegoUserCurrent, zeGoRoomConfig);
|
||||
// } else {
|
||||
// Log.w(TAG, "已经登录了多房间");
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出多房间
|
||||
*/
|
||||
public synchronized void logoutMultiRoom() {
|
||||
public synchronized void logoutMultiRoom(String sn) {
|
||||
Log.i(TAG, "尝试退出多房间 logoutMultiRoom multiRoomId : " + mLiveStatusModel.getMultiRoomId());
|
||||
if (mExpressEngine != null) {
|
||||
if (mLiveStatusModel.isLoginMultiRoom()) {
|
||||
Log.i(TAG, "执行退出多房间");
|
||||
mExpressEngine.logoutRoom(mLiveStatusModel.getMultiRoomId());
|
||||
} else {
|
||||
Log.w(TAG, "还未登录多房间");
|
||||
}
|
||||
// if (mLiveStatusModel.isLoginMultiRoom()) {
|
||||
Log.i(TAG, "执行退出多房间");
|
||||
mExpressEngine.logoutRoom(ROOM_ID_PREFIX + sn);
|
||||
// } else {
|
||||
// Log.w(TAG, "还未登录多房间");
|
||||
// }
|
||||
} else {
|
||||
Log.w(TAG, "ZeGo 引擎未初始化");
|
||||
}
|
||||
@@ -668,7 +696,27 @@ public class MoGoLiveManager {
|
||||
mLiveStatusModel.getMultiStreamId().startsWith(STREAM_ID_PREFIX)) {
|
||||
ZegoCanvas zegoCanvas = new ZegoCanvas(surfaceView);
|
||||
zegoCanvas.viewMode = ZegoViewMode.SCALE_TO_FILL;
|
||||
mExpressEngine.startPlayingStream(mLiveStatusModel.getMultiStreamId(), zegoCanvas);
|
||||
|
||||
ZegoPlayerConfig config = new ZegoPlayerConfig();
|
||||
config.roomID = mLiveStatusModel.getMultiRoomId();
|
||||
|
||||
mExpressEngine.startPlayingStream(mLiveStatusModel.getMultiStreamId(), zegoCanvas, config);
|
||||
} else {
|
||||
Log.e(TAG, "直播ID有误,请重试");
|
||||
}
|
||||
}
|
||||
|
||||
public void startLive(TextureView textureView) {
|
||||
Log.i(TAG, "尝试开始播放直播 startLive multiStreamId : " + mLiveStatusModel.getMultiStreamId());
|
||||
if (!TextUtils.isEmpty(mLiveStatusModel.getMultiStreamId()) &&
|
||||
mLiveStatusModel.getMultiStreamId().startsWith(STREAM_ID_PREFIX)) {
|
||||
ZegoCanvas zegoCanvas = new ZegoCanvas(textureView);
|
||||
zegoCanvas.viewMode = ZegoViewMode.SCALE_TO_FILL;
|
||||
|
||||
ZegoPlayerConfig config = new ZegoPlayerConfig();
|
||||
config.roomID = mLiveStatusModel.getMultiRoomId();
|
||||
|
||||
mExpressEngine.startPlayingStream(mLiveStatusModel.getMultiStreamId(), zegoCanvas, config);
|
||||
} else {
|
||||
Log.e(TAG, "直播ID有误,请重试");
|
||||
}
|
||||
@@ -689,7 +737,7 @@ public class MoGoLiveManager {
|
||||
/**
|
||||
* 停止播放直播
|
||||
*/
|
||||
public void stopLive() {
|
||||
public void stopLive(String sn) {
|
||||
Log.i(TAG, "尝试停止播放直播 stopLive multiStreamId : " + mLiveStatusModel.getMultiStreamId());
|
||||
if (mExpressEngine == null) {
|
||||
Log.w(TAG, "ZeGo 引擎未初始化");
|
||||
@@ -699,7 +747,7 @@ public class MoGoLiveManager {
|
||||
mExpressEngine.stopPlayingStream(mLiveStatusModel.getMultiStreamId());
|
||||
mExpressEngine.stopPreview();
|
||||
// 退出正在查看的多房间
|
||||
logoutMultiRoom();
|
||||
logoutMultiRoom(sn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -66,6 +66,9 @@ public class LiveStatusModel {
|
||||
}
|
||||
|
||||
public String getMultiRoomId() {
|
||||
if (multiRoomId == null) {
|
||||
return "";
|
||||
}
|
||||
return multiRoomId;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,11 @@ dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation "com.mogo.cloud:network:${MOGO_NETWORK_VERSION}"
|
||||
api "com.mogo.cloud:live:${MOGO_LIVE_VERSION}"
|
||||
api "com.mogo.cloud:utils:${MOGO_UTILS_VERSION}"
|
||||
} else {
|
||||
implementation project(":foudations:mogo-network")
|
||||
api project(":foudations:mogo-live")
|
||||
api project(':foudations:mogo-utils')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ public class TrafficLiveCurrentManager
|
||||
}
|
||||
}
|
||||
});
|
||||
MoGoLiveManager.getInstance().stopLive();
|
||||
MoGoLiveManager.getInstance().stopLive(liveSn);
|
||||
trafficLiveCallBack = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user