[Fix]修复行车超视距Bug
This commit is contained in:
@@ -61,7 +61,6 @@ class CameraListView : FrameLayout {
|
||||
)
|
||||
}
|
||||
private var liveSn: String? = ""
|
||||
private var isCarLive = false
|
||||
private var isFirstPage = true
|
||||
|
||||
@JvmOverloads
|
||||
@@ -85,20 +84,19 @@ class CameraListView : FrameLayout {
|
||||
isFirstPage = false
|
||||
isCloseStatus = false
|
||||
isPlaySuccess = false
|
||||
isCarLive = false
|
||||
liveSn = ""
|
||||
if (cameraEntity is CameraEntity) {
|
||||
when {
|
||||
!cameraEntity.isCarLive() -> {
|
||||
isCarLive = false
|
||||
// 开启摄像头推流
|
||||
cameraEntity.ip?.let { ip ->
|
||||
// 华哥那边现在只支持一个ip"183.242.46.150"
|
||||
CallerMonitorManager.openCameraStream(ip)
|
||||
// 测试一直打开的顺义摄像头,不需要调接口让摄像头开启推流
|
||||
// if (!cameraEntity.flvUrl.isNullOrEmpty()) gsyVideoPlay(cameraEntity.flvUrl!!)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
isCarLive = true
|
||||
liveSn = cameraEntity.sn
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(
|
||||
liveSn,
|
||||
@@ -127,7 +125,6 @@ class CameraListView : FrameLayout {
|
||||
}
|
||||
}
|
||||
clickListener?.onShowLive(false)
|
||||
isCarLive = false
|
||||
isPlaySuccess = false
|
||||
isFirstPage = true
|
||||
}
|
||||
@@ -177,7 +174,6 @@ class CameraListView : FrameLayout {
|
||||
clickListener?.onShowLive(false)
|
||||
}
|
||||
isPlaySuccess = false
|
||||
isCarLive = false
|
||||
}
|
||||
else -> {
|
||||
if (isPlaySuccess) {
|
||||
@@ -197,6 +193,10 @@ class CameraListView : FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private fun isCarLive(): Boolean {
|
||||
return !liveSn.isNullOrEmpty()
|
||||
}
|
||||
|
||||
fun startRoadCameraLive(flvUrl: String) {
|
||||
gsyVideoPlay(flvUrl)
|
||||
}
|
||||
@@ -225,8 +225,12 @@ class CameraListView : FrameLayout {
|
||||
}
|
||||
|
||||
override fun onFirstFrame() {
|
||||
Logger.d(TAG, "onFirstFrame:isFirstPage is:$isFirstPage,isCarLive is:$isCarLive")
|
||||
if (!isFirstPage && isCarLive) {
|
||||
Logger.d(TAG, "onFirstFrame:isFirstPage is:$isFirstPage,isCarLive is:${isCarLive()}")
|
||||
if (!isFirstPage && isCarLive()) {
|
||||
// 会出现临时中断后又可以继续播放,需要停掉倒计时
|
||||
if (valueAnimator.isStarted || valueAnimator.isRunning) {
|
||||
valueAnimator.cancel()
|
||||
}
|
||||
// 开始直播
|
||||
progressBar.visibility = View.GONE
|
||||
surfaceView.visibility = View.VISIBLE
|
||||
@@ -236,7 +240,7 @@ class CameraListView : FrameLayout {
|
||||
|
||||
override fun onDisConnect() {
|
||||
Logger.e(TAG, "onDisConnect")
|
||||
if (!isFirstPage && isCarLive) {
|
||||
if (!isFirstPage && isCarLive()) {
|
||||
showNoSignalView()
|
||||
if (!valueAnimator.isStarted && !valueAnimator.isRunning) {
|
||||
valueAnimator.start()
|
||||
@@ -246,7 +250,7 @@ class CameraListView : FrameLayout {
|
||||
|
||||
override fun onError(errorMsg: String?) {
|
||||
Logger.e(TAG, "onError msg is:${errorMsg}")
|
||||
if (!isFirstPage && isCarLive) {
|
||||
if (!isFirstPage && isCarLive()) {
|
||||
// 发生错误
|
||||
showNoSignalView()
|
||||
if (!valueAnimator.isStarted && !valueAnimator.isRunning) {
|
||||
@@ -292,7 +296,7 @@ class CameraListView : FrameLayout {
|
||||
private fun stopLive() {
|
||||
Logger.d(TAG, "stopLive")
|
||||
when {
|
||||
!isCarLive -> {
|
||||
!isCarLive() -> {
|
||||
try {
|
||||
GSYVideoManager.releaseAllVideos()
|
||||
} catch (e: Exception) {
|
||||
@@ -306,7 +310,7 @@ class CameraListView : FrameLayout {
|
||||
}
|
||||
|
||||
private fun showLiveView() {
|
||||
if (!isCarLive) {
|
||||
if (!isCarLive()) {
|
||||
surfaceView.visibility = View.GONE
|
||||
} else {
|
||||
svpPlayer.visibility = View.GONE
|
||||
|
||||
@@ -77,6 +77,7 @@ class CronTaskManager {
|
||||
*/
|
||||
private fun requestDeviceList() {
|
||||
CallerMapLocationListenerManager.getCurrentLocation()?.let { location ->
|
||||
// 办公室测试顺义摄像头(116.74071467, 40.20051636)
|
||||
disposable = netWork.create(CameraListServices::class.java, HostConst.MEC_ETL_HOST)
|
||||
.getDeviceList(location.longitude, location.latitude, 500)
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
Reference in New Issue
Block a user