This commit is contained in:
zhongchao
2021-04-01 17:56:33 +08:00
parent 7804ceb06c
commit 83252f79f5
10 changed files with 39 additions and 45 deletions

View File

@@ -5,6 +5,7 @@
<w>coor</w>
<w>designative</w>
<w>mogo</w>
<w>tongchenfei</w>
</words>
</dictionary>
</component>

View File

@@ -37,10 +37,8 @@ public class LiveStreamManagerImpl implements ILiveStreamManager {
private static final String C1 = "C_1"; //前置摄像头
private static final String C2 = "C_2"; //后置摄像头
private Handler mHandler; // 循环上报摄像头状态
private SocketMsgUtils mSocketMsgUtils; // Socket 长链接
private final SocketMsgUtils mSocketMsgUtils; // Socket 长链接
private MoGoLiveManager mLivePusher; // 自研直播SDK
private MoGoLivePushConfig mLivePushConfig;
public static LiveStreamManagerImpl getInstance(Application application, String devicesId) {
if (sInstance == null) {
@@ -87,7 +85,7 @@ public class LiveStreamManagerImpl implements ILiveStreamManager {
*/
private void initLivePush(String devicesId) {
// 初始化配置文件
mLivePushConfig = MoGoLivePushConfig.getInstance();
MoGoLivePushConfig mLivePushConfig = MoGoLivePushConfig.getInstance();
mLivePushConfig.setWidth(1280);
mLivePushConfig.setHeight(720);
mLivePushConfig.setVideoBitrate(6000);
@@ -176,7 +174,7 @@ public class LiveStreamManagerImpl implements ILiveStreamManager {
/**
* 循环同步摄像头状态
*/
private Runnable mCamStatusRun = () -> {
private final Runnable mCamStatusRun = () -> {
Logger.i(TAG, "循环同步摄像头状态");
uploadCamStatus(sCam1AvailableStatus, sCam2AvailableStatus);
restartCamStatusLoop();

View File

@@ -92,15 +92,15 @@ public class MoGoLiveManager {
/**
* 直播进度回调用
*/
private List<ILiveProgressListener> mProgressListener = new ArrayList<>();
private final List<ILiveProgressListener> mProgressListener = new ArrayList<>();
/**
* 直播房间连接状态
*/
private List<ILiveCurrentRoomStatusListener> mRoomStatusListener = new ArrayList<>();
private final List<ILiveCurrentRoomStatusListener> mRoomStatusListener = new ArrayList<>();
/**
* 直播第二个房间连接状态
*/
private List<ILiveMultiRoomStatusListener> mMultiRoomStatusListener = new ArrayList<>();
private final List<ILiveMultiRoomStatusListener> mMultiRoomStatusListener = new ArrayList<>();
/**
* 直播房间人员状态
*/
@@ -112,11 +112,11 @@ public class MoGoLiveManager {
/**
* 直播数据
*/
private LiveStatusModel mLiveStatusModel;
private final LiveStatusModel mLiveStatusModel;
/**
* 房间配置
*/
private ZegoRoomConfig zeGoRoomConfig;
private final ZegoRoomConfig zeGoRoomConfig;
private static final class Holder {
private static final MoGoLiveManager manager = new MoGoLiveManager();
@@ -173,10 +173,8 @@ public class MoGoLiveManager {
public void onDebugError(int errorCode, String funcName, String info) {
super.onDebugError(errorCode, funcName, info);
Logger.i(TAG, "调试错误信息回调 onDebugError errorCode : " + errorCode);
if (mProgressListener != null) {
for (ILiveProgressListener iLiveProgressListener : mProgressListener) {
iLiveProgressListener.onDebugError(errorCode, funcName, info);
}
for (ILiveProgressListener iLiveProgressListener : mProgressListener) {
iLiveProgressListener.onDebugError(errorCode, funcName, info);
}
// 停止推送数据
stopPublish();
@@ -187,15 +185,13 @@ public class MoGoLiveManager {
public void onEngineStateUpdate(ZegoEngineState state) {
super.onEngineStateUpdate(state);
Logger.i(TAG, "音视频引擎状态更新回调 onEngineStateUpdate state : " + state.name());
if (mProgressListener != null) {
if (state == ZegoEngineState.START) {
for (ILiveProgressListener iLiveProgressListener : mProgressListener) {
iLiveProgressListener.onEngineStart();
}
} else {
for (ILiveProgressListener iLiveProgressListener : mProgressListener) {
iLiveProgressListener.onEngineStop();
}
if (state == ZegoEngineState.START) {
for (ILiveProgressListener iLiveProgressListener : mProgressListener) {
iLiveProgressListener.onEngineStart();
}
} else {
for (ILiveProgressListener iLiveProgressListener : mProgressListener) {
iLiveProgressListener.onEngineStop();
}
}
}

View File

@@ -20,7 +20,7 @@ public class SocketMsgUtils implements IMogoCloudSocketMsgAckListener {
private static volatile SocketMsgUtils sInstance;
private SocketManager mSocketManager;
private Context mContext;
private final Context mContext;
private IMogoCloudSocketOnMessageListener mMessageListener;
public static SocketMsgUtils getInstance(Context context, IMogoCloudSocketOnMessageListener listener) {

View File

@@ -27,23 +27,23 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
USERNAME=xintai
PASSWORD=xintai2018
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
RELEASE=false
RELEASE=true
# AI CLOUD 云平台
# 工具类
MOGO_UTILS_VERSION=1.0.60
MOGO_UTILS_VERSION=1.0.61
# 网络请求
MOGO_NETWORK_VERSION=1.0.60
MOGO_NETWORK_VERSION=1.0.61
# 网络DNS
MOGO_HTTPDNS_VERSION=1.0.60
MOGO_HTTPDNS_VERSION=1.0.61
# 鉴权
MOGO_PASSPORT_VERSION=1.0.60
MOGO_PASSPORT_VERSION=1.0.61
# 常链接
MOGO_SOCKET_VERSION=1.0.60
MOGO_SOCKET_VERSION=1.0.61
# 数据采集
MOGO_REALTIME_VERSION=1.0.60
MOGO_REALTIME_VERSION=1.0.61
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.0.60
MOGO_TANLU_VERSION=1.0.61
# 直播推流
MOGO_LIVE_VERSION=1.0.60
MOGO_LIVE_VERSION=1.0.61
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.0.60
MOGO_TRAFFICLIVE_VERSION=1.0.61

View File

@@ -60,7 +60,7 @@ public class MogoRoadSearchManager {
* 通过经纬度信息查询
*
* @param roadInfoRequest 道路查询入参
* @param callback
* @param callback {@link IRoadInfoSearchCallback}
*/
public void queryRoadInfo(RoadInfoRequest roadInfoRequest, IRoadInfoSearchCallback callback) {
Map<String, Object> map = new HashMap<>();

View File

@@ -2,8 +2,8 @@ package com.mogo.cloud.tanlu.api;
import android.content.Context;
import com.mogo.cloud.tanlu.core.CosUpload;
import com.mogo.cloud.tanlu.bean.UploadInfo;
import com.mogo.cloud.tanlu.core.CosUpload;
/**
* @author lixiaopeng
@@ -30,10 +30,10 @@ public class MogoUploadManager {
/**
* 首先上传文件到cos然后把文件在cos的路径和其他参数一起上报服务端
*
* @brief 首先上传文件到cos然后把文件在cos的路径和其他参数一起上报服务端
* @param info 上报入参
* @param callback
* @param info 上报入参
* @param callback {@link ITanluUploadCallback}
*/
public void uploadInfo(UploadInfo info, ITanluUploadCallback callback) {
CosUpload.getInstance(mContext).init();

View File

@@ -39,7 +39,7 @@ public class CosUpload implements CosStatusCallback {
private UploadInfo mUploadInfo;
private String mCosVideoUrl;
private String mCosPicUrl;
private List<String> filePath = new ArrayList<>();
private final List<String> filePath = new ArrayList<>();
private String videoCoverImage;
private CosUpload(Context context) {

View File

@@ -52,7 +52,6 @@ public class UploadManager {
.create(TanluApiService.class);
}
/**
* @param informationBody
* @param callback

View File

@@ -15,12 +15,12 @@ import java.util.*
*/
@Keep
fun deletePicFile(filePath: String?): Boolean {
var file = File(filePath)
val file = File(filePath)
if (file.exists()) {
//如果图片地址包含此路径则是C上面的拍照需要再删除后摄图片
if (filePath!!.contains("usbotg-1-1.1")) {
//将地址替换成后摄图片地址
var backFile =
val backFile =
File(filePath.replace("frontPic", "backPic").replace("PhotoFront", "PhotoBack"))
if (backFile.exists()) {
return backFile.delete()
@@ -56,7 +56,7 @@ fun deleteAllFile(file: File?) { //判断文件不为null或文件目录存在
//根据本地视频文件生成缩略图文件
fun getVideoThumbnail(filePath: String, picPath: String): Boolean {
var b: Bitmap? = null
var retriever = MediaMetadataRetriever()
val retriever = MediaMetadataRetriever()
try {
retriever.setDataSource(filePath)
b = retriever.getFrameAtTime(0)
@@ -84,7 +84,7 @@ fun bitmapToFile(bitmap: Bitmap?, filePath: String): Boolean {
file.delete()
file.createNewFile()
val fos = FileOutputStream(file)
var ins = ByteArrayInputStream(baos.toByteArray())
val ins = ByteArrayInputStream(baos.toByteArray())
var x = 0
val b = ByteArray(1024 * 100)
while ({ x = ins.read(b);x }() != -1) {