Merge branch 'live_sdk' of http://gitlab.zhidaoauto.com/ecos/app/MoGoAiCloudSdk into live_sdk
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package com.mogo.cloud.live.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.live.listener.ILiveStatusListener;
|
||||
import com.mogo.cloud.live.server.PushService;
|
||||
import com.mogo.cloud.live.utils.LiveStreamUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
/**
|
||||
@@ -46,19 +46,19 @@ public class LiveStreamManagerImpl implements ILiveStreamManager {
|
||||
|
||||
@Override
|
||||
public void startLiveStream() {
|
||||
Log.d(TAG, "startLiveStream devices id:" + mDevicesId);
|
||||
Logger.d(TAG, "startLiveStream devices id:" + mDevicesId);
|
||||
PushService.startService(mContext, PushService.ACTION_START_RTMP_PUSH, mDevicesId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopLiveStream() {
|
||||
Log.d(TAG, "stopLiveStream devices id:" + mDevicesId);
|
||||
Logger.d(TAG, "stopLiveStream devices id:" + mDevicesId);
|
||||
PushService.startService(mContext, PushService.ACTION_STOP_RTMP_PUSH, mDevicesId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadCamStatus(int frontStatus, int backStatus) {
|
||||
Log.d(TAG, "uploadCamStatus frontStatus is:" + frontStatus + " backStatus is:" + backStatus);
|
||||
Logger.d(TAG, "uploadCamStatus frontStatus is:" + frontStatus + " backStatus is:" + backStatus);
|
||||
mLiveStreamUtils.uploadCamStatus(frontStatus, backStatus);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.cloud.live.manager;
|
||||
import android.app.Application;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceView;
|
||||
|
||||
import com.mogo.cloud.live.listener.ILiveProgressListener;
|
||||
@@ -18,7 +17,6 @@ import im.zego.zegoexpress.ZegoExpressEngine;
|
||||
import im.zego.zegoexpress.callback.IZegoCustomVideoCaptureHandler;
|
||||
import im.zego.zegoexpress.callback.IZegoEventHandler;
|
||||
import im.zego.zegoexpress.constants.ZegoEngineState;
|
||||
import im.zego.zegoexpress.constants.ZegoNetworkMode;
|
||||
import im.zego.zegoexpress.constants.ZegoPlayerState;
|
||||
import im.zego.zegoexpress.constants.ZegoPublishChannel;
|
||||
import im.zego.zegoexpress.constants.ZegoPublisherState;
|
||||
@@ -33,9 +31,7 @@ import im.zego.zegoexpress.entity.ZegoCanvas;
|
||||
import im.zego.zegoexpress.entity.ZegoCustomVideoCaptureConfig;
|
||||
import im.zego.zegoexpress.entity.ZegoEngineConfig;
|
||||
import im.zego.zegoexpress.entity.ZegoLogConfig;
|
||||
import im.zego.zegoexpress.entity.ZegoPlayStreamQuality;
|
||||
import im.zego.zegoexpress.entity.ZegoRoomConfig;
|
||||
import im.zego.zegoexpress.entity.ZegoStream;
|
||||
import im.zego.zegoexpress.entity.ZegoUser;
|
||||
import im.zego.zegoexpress.entity.ZegoVideoConfig;
|
||||
import im.zego.zegoexpress.entity.ZegoVideoFrameParam;
|
||||
@@ -172,7 +168,7 @@ public class MoGoLiveManager {
|
||||
@Override
|
||||
public void onDebugError(int errorCode, String funcName, String info) {
|
||||
super.onDebugError(errorCode, funcName, info);
|
||||
Log.i(TAG, "onDebugError errorCode : " + errorCode);
|
||||
Logger.i(TAG, "onDebugError errorCode : " + errorCode);
|
||||
if (listener != null) {
|
||||
listener.onDebugError(errorCode, funcName, info);
|
||||
}
|
||||
@@ -184,7 +180,7 @@ public class MoGoLiveManager {
|
||||
@Override
|
||||
public void onEngineStateUpdate(ZegoEngineState state) {
|
||||
super.onEngineStateUpdate(state);
|
||||
Log.i(TAG, "onEngineStateUpdate state : " + state.name());
|
||||
Logger.i(TAG, "onEngineStateUpdate state : " + state.name());
|
||||
if (state == ZegoEngineState.START) {
|
||||
if (listener != null) {
|
||||
listener.onStart();
|
||||
@@ -200,7 +196,7 @@ public class MoGoLiveManager {
|
||||
@Override
|
||||
public void onRoomStateUpdate(String roomID, ZegoRoomState state, int errorCode, JSONObject extendedData) {
|
||||
super.onRoomStateUpdate(roomID, state, errorCode, extendedData);
|
||||
Log.i(TAG, "onRoomStateUpdate roomID : " + roomID + " state:" + state + " errorCode:" + errorCode);
|
||||
Logger.i(TAG, "onRoomStateUpdate roomID : " + roomID + " state:" + state + " errorCode:" + errorCode);
|
||||
//房间状态更新
|
||||
if (state == ZegoRoomState.CONNECTING) {
|
||||
if (listener != null) {
|
||||
@@ -217,20 +213,19 @@ public class MoGoLiveManager {
|
||||
}
|
||||
}
|
||||
|
||||
// 房间内当前在线用户数量回调
|
||||
@Override
|
||||
public void onRoomOnlineUserCountUpdate(String roomID, int count) {
|
||||
super.onRoomOnlineUserCountUpdate(roomID, count);
|
||||
Logger.i(TAG, "onRoomOnlineUserCountUpdate roomID : " + roomID + " , count : " + count);
|
||||
}
|
||||
|
||||
// 房间内其他用户增加或减少的通知回调
|
||||
@Override
|
||||
public void onRoomUserUpdate(String roomID, ZegoUpdateType updateType, ArrayList<ZegoUser> userList) {
|
||||
super.onRoomUserUpdate(roomID, updateType, userList);
|
||||
//用户状态更新
|
||||
Log.i(TAG, "onRoomUserUpdate roomId : " + roomID + " , updateType : " + updateType.name());
|
||||
}
|
||||
|
||||
// 相同房间内其他用户推的流增加或减少的通知
|
||||
@Override
|
||||
public void onRoomStreamUpdate(String roomID, ZegoUpdateType updateType, ArrayList<ZegoStream> streamList, JSONObject extendedData) {
|
||||
super.onRoomStreamUpdate(roomID, updateType, streamList, extendedData);
|
||||
//有用户新推送或者删除音视频时,更新流状态
|
||||
Log.i(TAG, "onRoomStreamUpdate roomId : " + roomID + " , ZegoUpdateType : " + updateType.name());
|
||||
Logger.i(TAG, "onRoomUserUpdate roomId : " + roomID + " , updateType : " + updateType.name());
|
||||
}
|
||||
|
||||
// 推流状态回调
|
||||
@@ -238,7 +233,7 @@ public class MoGoLiveManager {
|
||||
public void onPublisherStateUpdate(String streamID, ZegoPublisherState state,
|
||||
int errorCode, JSONObject extendedData) {
|
||||
super.onPublisherStateUpdate(streamID, state, errorCode, extendedData);
|
||||
Log.i(TAG, "onPublisherStateUpdate streamID : " + streamID + " , state : " + state.name() + " , errorCode : " + errorCode);
|
||||
Logger.i(TAG, "onPublisherStateUpdate streamID : " + streamID + " , state : " + state.name() + " , errorCode : " + errorCode);
|
||||
isPushing = state == ZegoPublisherState.PUBLISHING;
|
||||
}
|
||||
|
||||
@@ -246,24 +241,10 @@ public class MoGoLiveManager {
|
||||
@Override
|
||||
public void onPlayerStateUpdate(String streamID, ZegoPlayerState state, int errorCode, JSONObject extendedData) {
|
||||
super.onPlayerStateUpdate(streamID, state, errorCode, extendedData);
|
||||
Log.i(TAG, "onPlayerStateUpdate streamId : " + streamID + " , state : " + state.name() + " , errorCode : " + errorCode + " , extendData : " + extendedData.toString());
|
||||
Logger.i(TAG, "onPlayerStateUpdate streamId : " + streamID + " , state : " + state.name() + " , errorCode : " + errorCode + " , extendData : " + extendedData.toString());
|
||||
isPlaying = state == ZegoPlayerState.PLAYING;
|
||||
}
|
||||
|
||||
// 拉流质量回调
|
||||
@Override
|
||||
public void onPlayerQualityUpdate(String streamID, ZegoPlayStreamQuality quality) {
|
||||
super.onPlayerQualityUpdate(streamID, quality);
|
||||
Log.i(TAG, "onPlayerQualityUpdate quality : " + quality.toString());
|
||||
}
|
||||
|
||||
// 网络模式变更回调
|
||||
@Override
|
||||
public void onNetworkModeChanged(ZegoNetworkMode mode) {
|
||||
super.onNetworkModeChanged(mode);
|
||||
Log.i(TAG, "onNetworkModeChanged mode : " + mode.name());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -297,7 +278,7 @@ public class MoGoLiveManager {
|
||||
ZegoRoomConfig zegoRoomConfig = new ZegoRoomConfig();
|
||||
zegoRoomConfig.isUserStatusNotify = true;
|
||||
mExpressEngine.loginRoom(currentRoomId, zegoUser, zegoRoomConfig);
|
||||
Log.i(TAG, "loginRoom userId:" + userId + " currentRoomId : " + currentRoomId
|
||||
Logger.i(TAG, "loginRoom userId:" + userId + " currentRoomId : " + currentRoomId
|
||||
+ " currentStreamId:" + currentStreamId);
|
||||
}
|
||||
|
||||
@@ -328,7 +309,7 @@ public class MoGoLiveManager {
|
||||
@Override
|
||||
public void onStart(ZegoPublishChannel channel) {
|
||||
super.onStart(channel);
|
||||
Log.i(TAG, "setCustomVideoCaptureHandler onStart");
|
||||
Logger.i(TAG, "setCustomVideoCaptureHandler onStart");
|
||||
isCaptureStatus = true;
|
||||
if (listener != null) {
|
||||
listener.onStart();
|
||||
@@ -338,7 +319,7 @@ public class MoGoLiveManager {
|
||||
@Override
|
||||
public void onStop(ZegoPublishChannel channel) {
|
||||
super.onStop(channel);
|
||||
Log.i(TAG, "setCustomVideoCaptureHandler onStop");
|
||||
Logger.i(TAG, "setCustomVideoCaptureHandler onStop");
|
||||
isCaptureStatus = false;
|
||||
if (listener != null) {
|
||||
listener.onStop();
|
||||
@@ -462,7 +443,7 @@ public class MoGoLiveManager {
|
||||
* 停止预览
|
||||
*/
|
||||
private void stopPreview() {
|
||||
if(mExpressEngine == null){
|
||||
if (mExpressEngine == null) {
|
||||
return;
|
||||
}
|
||||
mExpressEngine.stopPreview();
|
||||
@@ -480,7 +461,7 @@ public class MoGoLiveManager {
|
||||
* 停止推送数据
|
||||
*/
|
||||
private void stopPublishingStream() {
|
||||
if(mExpressEngine == null){
|
||||
if (mExpressEngine == null) {
|
||||
return;
|
||||
}
|
||||
// 停止推送
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.mogo.cloud.live.model;
|
||||
|
||||
/**
|
||||
* 接收服务器下发的指令
|
||||
*/
|
||||
public class CommandModel {
|
||||
private int type;
|
||||
private String videoChannel;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.cloud.live.model;
|
||||
|
||||
/**
|
||||
* 请求直播
|
||||
* 请求指定车机直播/关闭直播
|
||||
*/
|
||||
public class LivePush {
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.cloud.live.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LiveStatusInfo extends BaseData{
|
||||
|
||||
public Result result;
|
||||
|
||||
public class Result {
|
||||
public int alarmStatus;
|
||||
public List<LiveData> list;
|
||||
}
|
||||
|
||||
public class LiveData {
|
||||
public int status; // 0开始 1 结束
|
||||
public String livePushUrl;
|
||||
public String videoChannel;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.cloud.live.model;
|
||||
|
||||
import com.zhidao.utils.common.TelephoneUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PlaybackModel {
|
||||
private String sn;
|
||||
private String caller;
|
||||
private List<VideoModel> videoList;
|
||||
|
||||
public PlaybackModel() {
|
||||
this.sn = TelephoneUtil.getSerialNumber();
|
||||
//this.caller = CarAlarmConstants.CALLER;
|
||||
}
|
||||
|
||||
public void setVideoList(List<VideoModel> videoList) {
|
||||
this.videoList = videoList;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.cloud.live.model;
|
||||
|
||||
public class ResqReportCarAlarm {
|
||||
public String userId;
|
||||
public String sn;
|
||||
public double lat;
|
||||
public double lng;
|
||||
public long clientTime;
|
||||
public String eventId;
|
||||
public String caller;
|
||||
public String sdkVersion;
|
||||
public CamStatus cameraStatus;
|
||||
|
||||
public static class CamStatus {
|
||||
public int C_1;
|
||||
public int C_2;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.cloud.live.model;
|
||||
|
||||
public class StartCarAlarmInfo extends BaseData{
|
||||
public Result result;
|
||||
|
||||
public class Result {
|
||||
public String eventId;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.mogo.cloud.live.model;
|
||||
|
||||
/**
|
||||
* 视频
|
||||
*/
|
||||
public class VideoModel {
|
||||
public String videoChannel;
|
||||
public long videoStartTime;
|
||||
public long videoEndTime;
|
||||
private String videoName;
|
||||
public String url;
|
||||
public int status;// 0 未备份 1 已备份 2 已删除,必传:上传元数据时为0,补充url时为1,文件已删除时为2
|
||||
public String localPath;
|
||||
|
||||
public void setVideoName(String path) {
|
||||
//this.videoName = CustomUtils.getFileName(path);
|
||||
}
|
||||
|
||||
public String getVideoName() {
|
||||
return videoName;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +1,21 @@
|
||||
package com.mogo.cloud.live.network;
|
||||
|
||||
import com.mogo.cloud.live.model.BaseData;
|
||||
import com.mogo.cloud.live.model.LiveStatusInfo;
|
||||
import com.mogo.cloud.live.model.StartCarAlarmInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
* 直播功能使用到的接口
|
||||
*/
|
||||
public interface LiveApiServer {
|
||||
|
||||
@Headers({"Content-Type:application/json", "Accept:application/json"})
|
||||
@POST("/alarm/car/report")
|
||||
Observable<StartCarAlarmInfo> reportAlarm(@Body RequestBody body);
|
||||
|
||||
@Headers({"Content-Type:application/json", "Accept:application/json"})
|
||||
@POST("/alarm/car/report/cancel")
|
||||
Observable<BaseData> cancelAlarm(@Body RequestBody body);
|
||||
|
||||
@Headers({"Content-Type:application/json", "Accept:application/json"})
|
||||
@POST("/alarm/car/v2/video/liveStatus")
|
||||
Observable<LiveStatusInfo> requestLiveStatus(@Body RequestBody body);
|
||||
|
||||
@Headers({"Content-Type:application/json", "Accept:application/json"})
|
||||
@POST("/alarm/car/video/reportCameraStatus")
|
||||
Observable<BaseData> uploadCamStatus(@Body RequestBody body);
|
||||
|
||||
/**
|
||||
* 获取车辆前方直播Url
|
||||
*
|
||||
* @param vehicleHeadLiveMap 请求数据
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@@ -46,6 +25,7 @@ public interface LiveApiServer {
|
||||
|
||||
/**
|
||||
* 获取前方路口直播Url
|
||||
*
|
||||
* @param intersectionLiveMap 请求数据
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user