This commit is contained in:
lixiaopeng
2020-08-28 16:43:25 +08:00
parent 5830d8cc42
commit b336b4accf
3 changed files with 37 additions and 26 deletions

View File

@@ -9,6 +9,7 @@ import com.mogo.utils.NetworkUtils
import com.zhidao.auto.carcorder.callback.TakePhotoCallback
import com.zhidao.auto.carcorder.callback.TakeVideoCallback
import com.zhidao.auto.carcorder.controller.ZdCarCoderController
import com.zhidao.roadcondition.BuildConfig
import com.zhidao.roadcondition.constant.*
import com.zhidao.roadcondition.event.GetImageSuccessEvent
import com.zhidao.roadcondition.event.LatLngStickyEventBus
@@ -282,8 +283,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
)
val entity = CustomStatusHandler.pollVideoStatus()
if (!entity?.isCustom) {
trackNormalEvent(CarNet_auto_upload_video, null)
entity?.let {
if (!entity.isCustom) {
trackNormalEvent(CarNet_auto_upload_video, null)
}
}
if (isSuccess) {
@@ -297,25 +301,27 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
)
var speed = LocationUtil.getInstance().getSpeed()
if (entity?.isCustom) {
compressVideo(videoPath, thumbnailPath, entity)
} else {
Log.d(
TAG,
"onTakeVideoSuccess maxSpeedVideo = $maxSpeedVideo --->speed= $speed + minSpeedVideo = $minSpeedVideo"
)
if (maxSpeedVideo == -1) {
Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (Math.abs(minSpeedVideo) / 3.6f))
if (speed >= (Math.abs(minSpeedVideo) / 3.6f)) {
//获取视频以及缩略图成功,开始上报
compressVideo(videoPath, thumbnailPath, entity)
entity?.let {
if (entity.isCustom) {
compressVideo(videoPath, thumbnailPath, entity)
} else {
Log.d(
TAG,
"onTakeVideoSuccess maxSpeedVideo = $maxSpeedVideo --->speed= $speed + minSpeedVideo = $minSpeedVideo"
)
if (maxSpeedVideo == -1) {
Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (Math.abs(minSpeedVideo) / 3.6f))
if (speed >= (Math.abs(minSpeedVideo) / 3.6f)) {
//获取视频以及缩略图成功,开始上报
compressVideo(videoPath, thumbnailPath, entity)
}
}
}
if (minSpeedVideo > 0 && maxSpeedVideo > 0) {
Log.d(TAG, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed")
if ((speed >= (minSpeedVideo / 3.6f)) && speed <= (maxSpeedVideo / 3.6f)) {
compressVideo(videoPath, thumbnailPath, entity)
if (minSpeedVideo > 0 && maxSpeedVideo > 0) {
Log.d(TAG, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed")
if ((speed >= (minSpeedVideo / 3.6f)) && speed <= (maxSpeedVideo / 3.6f)) {
compressVideo(videoPath, thumbnailPath, entity)
}
}
}
}
@@ -332,10 +338,13 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
Log.e(TAG, "getVideo onTakeVideoFail")
getVideoFailed?.invoke()
val entity = CustomStatusHandler.pollVideoStatus()
InformationUploadController.release(entity?.id)
Log.e(TAG, "getVideo onTakeVideoFail entity?.isCustom =" + entity?.isCustom)
if (entity?.isCustom) {
entity?.let {
InformationUploadController.release(entity.id)
Log.e(TAG, "getVideo onTakeVideoFail entity?.isCustom =" + entity?.isCustom)
if (entity?.isCustom) {
// sendGetInfoFailedReceiver(mType)
}
}
//失败了,传空地址,发起请求

View File

@@ -195,17 +195,18 @@ class CosStatusController : CosStatusCallback {
type: Int,
map: Map<String, String>,
poiType: String,
entity: TakeEntity,
entity: TakeEntity?,
mainInfoId: Long,
longitude: Double,
latitude: Double
) {
Log.d(TAG, "sendInformationDirectly isCustomSend = ${entity?.isCustom}")
Log.d(TAG, "sendInformationDirectly poiType= $poiType ---- mainInfoId= $mainInfoId")
mainServiceHttpModel.sendInformationMessage(
entity?.isCustom?.let {
mainServiceHttpModel.sendInformationMessage(
type = type,
url = map,
isCustom = entity?.isCustom,
isCustom = it,
poiType = poiType,
mainInfoId = mainInfoId,
longitude = longitude,
@@ -216,6 +217,7 @@ class CosStatusController : CosStatusCallback {
CosCallbackMapController.mainService?.sendCustomResult(success)
}
}
}
}
override fun onProgress(localPath: String?, progress: Float) {

View File

@@ -23,7 +23,7 @@ object CustomStatusHandler {
takeVideoStatusQueue.offer(entity)
}
fun pollVideoStatus(): TakeEntity = takeVideoStatusQueue.poll()
fun pollVideoStatus(): TakeEntity? = takeVideoStatusQueue.poll()
}
class TakeEntity(