修复了在线状态的bug
This commit is contained in:
@@ -29,6 +29,8 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
protected ToggleButton btnLive;
|
||||
// 保存文件到本地
|
||||
private ToggleButton btnSaveFile;
|
||||
// 设置摄像头与状态
|
||||
private ToggleButton btnChangeCameraState;
|
||||
|
||||
// 相机数据预览
|
||||
protected SurfaceView surfaceView;
|
||||
@@ -56,6 +58,12 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
btnChangeCameraState = findViewById(R.id.btnChangeCameraState);
|
||||
btnChangeCameraState.setOnCheckedChangeListener((btnSaveFile, isChecked) -> {
|
||||
Toast.makeText(getApplicationContext(), btnSaveFile.getText(), Toast.LENGTH_SHORT).show();
|
||||
toggleCameraState(isChecked);
|
||||
});
|
||||
|
||||
initCamer();
|
||||
}
|
||||
|
||||
@@ -139,4 +147,11 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
*/
|
||||
public abstract void toggleLive(boolean isLive);
|
||||
|
||||
/**
|
||||
* 摄像头状态
|
||||
*
|
||||
* @param isLive true-可以直播,false-不可以直播
|
||||
*/
|
||||
public abstract void toggleCameraState(boolean isLive);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.live.manager.ILiveStreamManager;
|
||||
import com.mogo.cloud.live.manager.LiveStreamManagerImpl;
|
||||
@@ -20,7 +21,6 @@ public class LivePushActivity extends BaseLiveActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
// 初始化直播流管理
|
||||
liveStreamManager = LiveStreamManagerImpl.getInstance(this, MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
liveStreamManager.uploadCamStatus(1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,6 +37,16 @@ public class LivePushActivity extends BaseLiveActivity {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleCameraState(boolean isLive) {
|
||||
Log.i(TAG, "toggleCameraState isLive: " + isLive);
|
||||
if (isLive) {
|
||||
liveStreamManager.uploadCamStatus(1, 1);
|
||||
} else {
|
||||
liveStreamManager.uploadCamStatus(2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
Reference in New Issue
Block a user