[Change]
增加查看指定SN的功能,辅助录制视频和排查问题
This commit is contained in:
@@ -12,16 +12,12 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
@@ -64,6 +60,12 @@
|
||||
android:label="直播播放"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="stateHidden" />
|
||||
<activity
|
||||
android:name=".LivePlayOneActivity"
|
||||
android:label="直播播放"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="landscape"
|
||||
android:windowSoftInputMode="stateHidden" />
|
||||
<activity
|
||||
android:name=".network.NetworkActivity"
|
||||
android:label="网络测试"
|
||||
|
||||
@@ -186,6 +186,13 @@ public class LivePlayActivity extends AppCompatActivity implements ITrafficCarLi
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn0);
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn1);
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn2);
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn3);
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn4);
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn5);
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn6);
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn7);
|
||||
WifiStateManager.getInstance().unRegisterWifiStateListener(this);
|
||||
}
|
||||
|
||||
|
||||
96
app/src/main/java/com/mogo/cloud/LivePlayOneActivity.java
Normal file
96
app/src/main/java/com/mogo/cloud/LivePlayOneActivity.java
Normal file
@@ -0,0 +1,96 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.mogo.cloud.live.manager.LiveStreamManagerImpl;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.trafficlive.api.ITrafficCarLiveCallBack;
|
||||
import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive;
|
||||
import com.mogo.cloud.wifi.IWifiStateListener;
|
||||
import com.mogo.cloud.wifi.WifiStateManager;
|
||||
|
||||
|
||||
/**
|
||||
* @author mogoauto
|
||||
*/
|
||||
public class LivePlayOneActivity extends AppCompatActivity implements ITrafficCarLiveCallBack, IWifiStateListener {
|
||||
private String TAG = "LiveActivity";
|
||||
private TextView tvWifiState;
|
||||
|
||||
private SurfaceView surfaceView;
|
||||
private ToggleButton liveToggleBtn;
|
||||
private EditText etLookRoomId;
|
||||
private String liveSn;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_live_play_on);
|
||||
|
||||
LiveStreamManagerImpl.getInstance(this.getApplication(),
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), false);
|
||||
tvWifiState = findViewById(R.id.tvWifiState);
|
||||
|
||||
surfaceView = findViewById(R.id.surfaceView);
|
||||
etLookRoomId = findViewById(R.id.etLookRoomId);
|
||||
liveToggleBtn = findViewById(R.id.liveToggleBtn);
|
||||
liveToggleBtn.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
Toast.makeText(getApplicationContext(), buttonView.getText(), Toast.LENGTH_SHORT).show();
|
||||
if (isChecked) {
|
||||
liveSn = etLookRoomId.getText().toString().trim();
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(liveSn, surfaceView, this);
|
||||
} else {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn);
|
||||
}
|
||||
});
|
||||
|
||||
surfaceView.setOnClickListener(v -> {
|
||||
if (liveToggleBtn.getVisibility() == View.VISIBLE) {
|
||||
liveToggleBtn.setVisibility(View.GONE);
|
||||
etLookRoomId.setVisibility(View.GONE);
|
||||
} else {
|
||||
liveToggleBtn.setVisibility(View.VISIBLE);
|
||||
etLookRoomId.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn);
|
||||
WifiStateManager.getInstance().unRegisterWifiStateListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLive(String liveSn) {
|
||||
Log.d(TAG, "开始直播 onLive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisConnect() {
|
||||
Log.w(TAG, "失去连接 onDisConnect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String errorMsg) {
|
||||
Log.e(TAG, "发生错误 onError msg: " + errorMsg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWifiState(WifiInfo wifiInfo) {
|
||||
tvWifiState.setText("wifiLevel: " + Math.abs(wifiInfo.getRssi()));
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
private Button btnJumpLivePlayAndPush;
|
||||
private Button btnJumpLivePush;
|
||||
private Button btnJumpLivePlay;
|
||||
private Button btnJumpLivePlayOne;
|
||||
private Button btnRequestXINGLive;
|
||||
private Button btnRequestCarLive;
|
||||
private Button btnV2XFunctionTest;
|
||||
@@ -116,6 +117,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
btnJumpLivePlayOne = findViewById(R.id.btnJumpLivePlayOne);
|
||||
btnJumpLivePlayOne.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(MainActivity.this, LivePlayOneActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
btnRequestXINGLive = findViewById(R.id.btnRequestXINGLive);
|
||||
btnRequestXINGLive.setOnClickListener(v -> {
|
||||
MoGoAiCloudTrafficLive.viewDesignativeIntersectionLive("556834859_trafficcamera_100514_89", new ITrafficIntersectionLiveCallBack() {
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MoGoApplication extends MultiDexApplication {
|
||||
// 设置AI云平台分配给三方应用的签名密钥,需要从AI云平台申请
|
||||
// 设置车机设备的唯一标识(这些表识必须是通过后台录入的设备)
|
||||
// TODO 这里使用的是测试的sn
|
||||
clientConfig.setThirdPartyDeviceId("1234567899876543214");
|
||||
clientConfig.setThirdPartyDeviceId("1234567899876543218");
|
||||
// 设置应用服务AppId 长链、鉴权 //todo 需要卸载智慧驾驶、行车记录仪
|
||||
clientConfig.setServiceAppId("com.mogo.launcher");
|
||||
// 设置循环检测间隔时间
|
||||
|
||||
50
app/src/main/res/layout/activity_live_play_on.xml
Normal file
50
app/src/main/res/layout/activity_live_play_on.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView 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:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surfaceView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout_editor_absoluteX="0dp"
|
||||
tools:layout_editor_absoluteY="0dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etLookRoomId"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="请输入要查看的车机SN"
|
||||
android:text="F803EB2046PZD00149"
|
||||
android:textColor="#850808"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/liveToggleBtn"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<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_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -98,6 +98,13 @@
|
||||
android:text="直播SDK观看测试"
|
||||
android:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnJumpLivePlayOne"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="查看指定SN车辆直播"
|
||||
android:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnRequestXINGLive"
|
||||
android:layout_width="match_parent"
|
||||
@@ -117,7 +124,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="V2X模块测试"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnNSDNetty"
|
||||
@@ -131,7 +138,7 @@
|
||||
android:id="@+id/btnV2XFunctionTest"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surfacePreviewView"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user