[Update]增加api支持TextureView播放直播
This commit is contained in:
@@ -4,6 +4,7 @@ import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.TextureView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ToggleButton;
|
||||
@@ -38,7 +39,7 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
protected SurfaceView surfacePreviewView;
|
||||
|
||||
// 查看指定车机的画面
|
||||
protected SurfaceView surfacePlayView;
|
||||
protected TextureView textureView;
|
||||
// 查看直播按钮
|
||||
protected ToggleButton liveToggleBtn;
|
||||
// 登录第二个房间的按钮
|
||||
@@ -79,7 +80,7 @@ public abstract class BaseLiveActivity extends AppCompatActivity {
|
||||
|
||||
tvLiveStatus = findViewById(R.id.tvLiveStatus);
|
||||
|
||||
surfacePlayView = findViewById(R.id.surfacePlayView);
|
||||
textureView = findViewById(R.id.textureView);
|
||||
etLookRoomId = findViewById(R.id.etLookRoomId);
|
||||
liveToggleBtn = findViewById(R.id.liveToggleBtn);
|
||||
liveToggleBtn.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class LivePlayAndPushActivity extends BaseLiveActivity
|
||||
public void togglePlay(boolean isPlay) {
|
||||
if (isPlay) {
|
||||
liveSn = etLookRoomId.getText().toString().trim();
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(liveSn, surfacePlayView, this);
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(liveSn, textureView, this);
|
||||
} else {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn);
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class LivePlayAndPushActivity extends BaseLiveActivity
|
||||
|
||||
@Override
|
||||
public void onFirstFrame() {
|
||||
surfacePlayView.setVisibility(View.VISIBLE);
|
||||
textureView.setVisibility(View.VISIBLE);
|
||||
Logger.d(TAG, "onFirstFrame");
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,24 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/surfacePlayView"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textureView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surfacePlayView"
|
||||
<!-- <SurfaceView-->
|
||||
<!-- android:id="@+id/textureView"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:layout_weight="1"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/surfacePreviewView"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- android:visibility="invisible"-->
|
||||
<!-- />-->
|
||||
|
||||
<TextureView
|
||||
android:id="@+id/textureView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
@@ -47,8 +59,8 @@
|
||||
android:textColor="#FF5722"
|
||||
android:textSize="25dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="@+id/surfacePlayView"
|
||||
app:layout_constraintStart_toStartOf="@+id/surfacePlayView"
|
||||
app:layout_constraintEnd_toEndOf="@+id/textureView"
|
||||
app:layout_constraintStart_toStartOf="@+id/textureView"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -110,7 +122,7 @@
|
||||
android:textColor="#000"
|
||||
app:layout_constraintBottom_toTopOf="@+id/liveToggleBtn"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/surfacePlayView" />
|
||||
app:layout_constraintStart_toStartOf="@+id/textureView" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbLoginMultiRoom"
|
||||
|
||||
Reference in New Issue
Block a user