增加了直播状态向外的同步回调
This commit is contained in:
@@ -28,10 +28,11 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
// 开始直播
|
||||
protected ToggleButton btnLive;
|
||||
// 保存文件到本地
|
||||
private ToggleButton btnSaveFile;
|
||||
protected ToggleButton btnSaveFile;
|
||||
// 设置摄像头与状态
|
||||
private ToggleButton btnChangeCameraState;
|
||||
|
||||
protected ToggleButton btnChangeCameraState;
|
||||
// 当前直播的状态
|
||||
protected ToggleButton tbLiveStatus;
|
||||
// 相机数据预览
|
||||
protected SurfaceView surfaceView;
|
||||
|
||||
@@ -64,6 +65,8 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
toggleCameraState(isChecked);
|
||||
});
|
||||
|
||||
tbLiveStatus = findViewById(R.id.tbLiveStatus);
|
||||
|
||||
initCamer();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.cloud;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.live.listener.ILiveStatusListener;
|
||||
import com.mogo.cloud.live.manager.ILiveStreamManager;
|
||||
import com.mogo.cloud.live.manager.LiveStreamManagerImpl;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
@@ -22,6 +23,23 @@ public class LivePushActivity extends BaseLiveActivity {
|
||||
// 初始化直播流管理
|
||||
liveStreamManager = LiveStreamManagerImpl.getInstance(this,
|
||||
MoGoAiCloudClientConfig.getInstance().getThirdPartyDeviceId());
|
||||
liveStreamManager.setLiveStatusChangeCallback(new ILiveStatusListener() {
|
||||
@Override
|
||||
public void onChange(String camId, int status) {
|
||||
tbLiveStatus.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (status == 0) {
|
||||
tbLiveStatus.setTextColor(getResources().getColor(R.color.colorStartLive));
|
||||
tbLiveStatus.setChecked(true);
|
||||
} else {
|
||||
tbLiveStatus.setTextColor(getResources().getColor(R.color.colorStopLive));
|
||||
tbLiveStatus.setChecked(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user