加入了多房间登录操作来解决同一设备推流同时拉流
This commit is contained in:
@@ -5,10 +5,11 @@ import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
|
||||
import com.mogo.cloud.util.YuvToolUtils;
|
||||
import com.zhidao.manager.camera.FrameBufferCallBack;
|
||||
import com.zhidao.manager.camera.ZDCameraManager;
|
||||
@@ -34,16 +35,25 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
// 当前直播的状态
|
||||
protected ToggleButton tbLiveStatus;
|
||||
// 相机数据预览
|
||||
protected SurfaceView surfaceView;
|
||||
protected SurfaceView surfacePreviewView;
|
||||
|
||||
// 查看指定车机的画面
|
||||
protected SurfaceView surfacePlayView;
|
||||
// 查看直播按钮
|
||||
protected ToggleButton liveToggleBtn;
|
||||
// 要查看的车机SN
|
||||
protected EditText etLookRoomId;
|
||||
// WIFI状态
|
||||
protected TextView tvWifiState;
|
||||
|
||||
private ZDCameraManager zdCameraManager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_live_push);
|
||||
setContentView(R.layout.activity_live_play_and_push);
|
||||
|
||||
surfaceView = findViewById(R.id.surfaceView);
|
||||
surfacePreviewView = findViewById(R.id.surfacePreviewView);
|
||||
btnLive = findViewById(R.id.btnLive);
|
||||
btnLive.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
Toast.makeText(getApplicationContext(), buttonView.getText(), Toast.LENGTH_SHORT).show();
|
||||
@@ -67,6 +77,15 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
|
||||
tbLiveStatus = findViewById(R.id.tbLiveStatus);
|
||||
|
||||
surfacePlayView = findViewById(R.id.surfacePlayView);
|
||||
etLookRoomId = findViewById(R.id.etLookRoomId);
|
||||
liveToggleBtn = findViewById(R.id.liveToggleBtn);
|
||||
liveToggleBtn.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
Toast.makeText(getApplicationContext(), buttonView.getText(), Toast.LENGTH_SHORT).show();
|
||||
togglePlay(isChecked);
|
||||
});
|
||||
tvWifiState = findViewById(R.id.tvWifiState);
|
||||
|
||||
initCamer();
|
||||
}
|
||||
|
||||
@@ -106,7 +125,7 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
// 这里是纯预览
|
||||
surfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||
surfacePreviewView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
Log.i(TAG, "addSurfaceCallBack id");
|
||||
@@ -157,4 +176,11 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
*/
|
||||
public abstract void toggleCameraState(boolean isLive);
|
||||
|
||||
/**
|
||||
* 开关查看直播
|
||||
*
|
||||
* @param isPlay true-查看直播,false-不查看直播
|
||||
*/
|
||||
public abstract void togglePlay(boolean isPlay);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user