[Update]优化全览模式摄像头呈现和播放
@@ -164,10 +164,10 @@ import java.util.*
|
||||
}
|
||||
}
|
||||
|
||||
/*ivCameraIcon?.setOnLongClickListener {
|
||||
activity?.let { it1 -> CarcorderPreviewView.show(it1) }
|
||||
ivCameraIcon?.setOnLongClickListener {
|
||||
showSmallFragment()
|
||||
true
|
||||
}*/
|
||||
}
|
||||
|
||||
ivToolsIcon?.setOnClickListener {
|
||||
if (toolsViewFloat == null) {
|
||||
|
||||
@@ -40,10 +40,13 @@ class RoadVideoDialog(context: Context) : BaseFloatDialog(context), LifecycleObs
|
||||
|
||||
init {
|
||||
setContentView(R.layout.road_video_dialog)
|
||||
roadVideoPB.indeterminateDrawable.colorFilter = PorterDuffColorFilter(
|
||||
ContextCompat.getColor(context, R.color.notice_blue),
|
||||
PorterDuff.Mode.MULTIPLY
|
||||
)
|
||||
setCanceledOnTouchOutside(true)
|
||||
|
||||
roadVideoClose.setOnClickListener {
|
||||
stopLive()
|
||||
dismiss()
|
||||
}
|
||||
|
||||
@@ -52,12 +55,14 @@ class RoadVideoDialog(context: Context) : BaseFloatDialog(context), LifecycleObs
|
||||
|
||||
fun show(url: String, isFlvUrl: Boolean) {
|
||||
show()
|
||||
roadVideoPB.visibility = View.VISIBLE
|
||||
if (!isFlvUrl) {
|
||||
// 打开指定ip的摄像头直播流
|
||||
CallerMonitorManager.openCameraStream(url, { flvUrl ->
|
||||
gsyVideoPlay(flvUrl)
|
||||
}) {
|
||||
ToastUtils.showShort(it.message)
|
||||
dismiss()
|
||||
}
|
||||
} else {
|
||||
gsyVideoPlay(url)
|
||||
@@ -93,10 +98,6 @@ class RoadVideoDialog(context: Context) : BaseFloatDialog(context), LifecycleObs
|
||||
}
|
||||
}
|
||||
})
|
||||
roadVideoPB.indeterminateDrawable.colorFilter = PorterDuffColorFilter(
|
||||
ContextCompat.getColor(context, R.color.notice_blue),
|
||||
PorterDuff.Mode.MULTIPLY
|
||||
)
|
||||
}
|
||||
|
||||
private fun gsyVideoPlay(flvUrl: String) {
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.mogo.eagle.core.function.main.stagetwo;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.test.crashreport.CrashReportConstants;
|
||||
import com.mogo.test.crashreport.upgrade.UpgradeReportConstants;
|
||||
import com.rousetime.android_startup.AndroidStartup;
|
||||
|
||||
public class APMStartup extends AndroidStartup<Boolean> {
|
||||
@Nullable
|
||||
@Override
|
||||
public Boolean create(@NonNull Context context) {
|
||||
// bugly
|
||||
ARouter.getInstance().build(UpgradeReportConstants.PATH).navigation();
|
||||
// apm
|
||||
ARouter.getInstance().build(CrashReportConstants.PATH).navigation();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean callCreateOnMainThread() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean waitOnMainThread() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.4 MiB |
@@ -7,6 +7,7 @@
|
||||
android:minWidth="1736px"
|
||||
android:minHeight="974px"
|
||||
app:roundLayoutRadius="30px"
|
||||
android:background="@drawable/road_video_bg"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.overview
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import java.util.*
|
||||
|
||||
@Entity(tableName = "t_device")
|
||||
data class Infrastructure(
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.mogo.eagle.core.function.overview.vm
|
||||
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.*
|
||||
import com.mogo.eagle.core.function.overview.Infrastructure
|
||||
import com.mogo.eagle.core.function.overview.OverviewDao
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.lang.Exception
|
||||
|
||||
class OverViewModel(
|
||||
@@ -48,7 +45,6 @@ class OverViewModel(
|
||||
// overviewDao.listAllInfStructures()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
Log.e("cff", "${e.cause}${e.message}")
|
||||
null
|
||||
}
|
||||
data?.let {
|
||||
@@ -63,7 +59,6 @@ class OverViewModel(
|
||||
overviewDao.updateGeoHash(id, geoHash)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
Log.e("cff", "${e.cause}${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ import com.mogo.eagle.core.function.overview.Infrastructure;
|
||||
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.common.utils.DrivingDirectionUtils;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
@@ -147,7 +146,8 @@ public class AMapCustomView
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
|
||||
//设置全览模式
|
||||
overLayerView.setOnClickListener(v -> {
|
||||
mAMapNaviView.displayOverview();
|
||||
CallerHmiManager.INSTANCE.hideSmallFragment();
|
||||
// mAMapNaviView.displayOverview();
|
||||
});
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
|
||||
@@ -738,14 +738,38 @@ public class AMapCustomView
|
||||
}
|
||||
ArrayList<MarkerOptions> markerOptionsList = new ArrayList();
|
||||
for (ArrayList<Infrastructure> structureList : pathMap.values()) {
|
||||
int firstQuadrantCt = 0, secondQuadrantCt = 0, thirdQuadrantCt = 0, forthQuadrantCt = 0;
|
||||
// 每个GeoHash内根据坐标系象限分散开摄像头icon显示
|
||||
for (Infrastructure structure : structureList) {
|
||||
MarkerOptions markerOption = new MarkerOptions();
|
||||
LatLng latLng = new LatLng(Double.valueOf(structure.getLat()),
|
||||
Double.valueOf(structure.getLon()));
|
||||
markerOption.position(latLng);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
BitmapFactory.decodeResource(getResources(), R.drawable.video_nor)
|
||||
));
|
||||
if (structure.getHeading() >= 0 && structure.getHeading() <= 90) {
|
||||
markerOption.anchor(0.5f * firstQuadrantCt, 0.5f + 0.5f * firstQuadrantCt);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_right)
|
||||
));
|
||||
firstQuadrantCt++;
|
||||
} else if (structure.getHeading() >= 90 && structure.getHeading() <= 180) {
|
||||
markerOption.anchor(0.5f * secondQuadrantCt, 0.5f * secondQuadrantCt);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_right)
|
||||
));
|
||||
secondQuadrantCt++;
|
||||
} else if (structure.getHeading() >= 180 && structure.getHeading() <= 270) {
|
||||
markerOption.anchor(0.5f + 0.5f * thirdQuadrantCt, 0.5f * thirdQuadrantCt);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_left)
|
||||
));
|
||||
thirdQuadrantCt++;
|
||||
} else {
|
||||
markerOption.anchor(0.75f + 0.25f * forthQuadrantCt, 0.75f + 0.25f * forthQuadrantCt);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(
|
||||
BitmapFactory.decodeResource(getResources(),R.drawable.video_icon_left)
|
||||
));
|
||||
forthQuadrantCt++;
|
||||
}
|
||||
posInfMap.put(latLng, structure);
|
||||
markerOptionsList.add(markerOption);
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
@@ -13,6 +13,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MONITOR
|
||||
import com.mogo.map.MogoLocationClient
|
||||
import com.mogo.module.common.constants.HostConst
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
@@ -219,16 +220,28 @@ class CronTaskManager(private var context: Context?) {
|
||||
}
|
||||
streamDisposable2 = MoGoRetrofitFactory.getInstance(HostConst.CITY_HOST)
|
||||
.create(CameraListServices::class.java)
|
||||
.reqOpenCameraStream(cameraIp)
|
||||
.reqOpenCameraStreamWithRetry(cameraIp)
|
||||
.flatMap {
|
||||
if (it.code != 200 && it.code != 0) {
|
||||
Observable.error(Throwable(it.msg))
|
||||
} else {
|
||||
Observable.just(it)
|
||||
}
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.retryWhen(RetryWithDelay())
|
||||
.subscribe({
|
||||
CallerLogger.d("$M_MONITOR$TAG", "reqOpenCameraStream返回结果为:$it")
|
||||
val flvString = it.flvUrl
|
||||
if (!flvString.isNullOrEmpty()) {
|
||||
success(flvString)
|
||||
if (it.code == 200 || it.code == 0) {
|
||||
val flvString = it.flvUrl
|
||||
if (!flvString.isNullOrEmpty()) {
|
||||
success(flvString)
|
||||
} else {
|
||||
error(Throwable("flvUrl为空"))
|
||||
}
|
||||
} else {
|
||||
error(Throwable("flvUrl为空"))
|
||||
error(Throwable(it.msg))
|
||||
}
|
||||
}, {
|
||||
CallerLogger.e(
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mogo.eagle.core.function.monitoring;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
public class RetryWithDelay implements Function<Observable<? extends Throwable>, Observable<?>> {
|
||||
|
||||
private final int maxRetries = 3;
|
||||
private final int retryDelayMillis = 5000;
|
||||
// 计数器
|
||||
private int retryCount = 0;
|
||||
|
||||
@Override
|
||||
public Observable<?> apply(Observable<? extends Throwable> observable) throws Exception {
|
||||
return observable.flatMap((Function<Throwable, ObservableSource<?>>) throwable -> {
|
||||
if (++retryCount <= maxRetries) {
|
||||
return Observable.timer(retryDelayMillis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
return Observable.error(throwable);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.function.monitoring.net
|
||||
|
||||
import com.mogo.eagle.core.data.camera.*
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
import retrofit2.http.*
|
||||
|
||||
@@ -22,4 +23,7 @@ interface CameraListServices {
|
||||
@Query("lon") lon: Double, @Query("lat") lat: Double,
|
||||
@Query("radiusMeter") radiusMeter: Int
|
||||
): Single<CameraListInfo?>
|
||||
|
||||
@GET("/camera-stream/stream/camera/openStream")
|
||||
fun reqOpenCameraStreamWithRetry(@Query("ip") cameraIp: String): Observable<OpenCameraStreamEntity>
|
||||
}
|
||||