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:
donghongyu
2021-11-30 16:51:48 +08:00
13 changed files with 330 additions and 74 deletions

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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>