finish the interface of live
This commit is contained in:
@@ -38,6 +38,7 @@ public class LivePlayActivity extends AppCompatActivity implements ITrafficCarLi
|
||||
if (isChecked) {
|
||||
liveSn = etLookRoomId.getText().toString().trim();
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(liveSn, surfaceView, this);
|
||||
//just for test
|
||||
// MoGoAiCloudTrafficLive.viewFrontVehicleLive(39.968253, 116.410829, 0, surfaceView, this);
|
||||
} else {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn);
|
||||
|
||||
@@ -92,7 +92,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
btnRequestXINGLive = findViewById(R.id.btnRequestXINGLive);
|
||||
btnRequestXINGLive.setOnClickListener(v -> {
|
||||
MoGoAiCloudTrafficLive.viewFrontIntersectionLive(40.11547, 116.22544, 60, new ITrafficIntersectionLiveCallBack() {
|
||||
MoGoAiCloudTrafficLive.viewDesignativeIntersectionLive("POLE1617103029423", new ITrafficIntersectionLiveCallBack() {
|
||||
@Override
|
||||
public void liveUrlResult(String liveUrl) {
|
||||
Logger.d(TAG, "liveUrl : " + liveUrl);
|
||||
@@ -103,6 +103,17 @@ public class MainActivity extends AppCompatActivity {
|
||||
Logger.e(TAG, "errorMsg : " + errorMsg);
|
||||
}
|
||||
});
|
||||
// MoGoAiCloudTrafficLive.viewFrontIntersectionLive(40.11547, 116.22544, 60, new ITrafficIntersectionLiveCallBack() {
|
||||
// @Override
|
||||
// public void liveUrlResult(String liveUrl) {
|
||||
// Logger.d(TAG, "liveUrl : " + liveUrl);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(String errorMsg) {
|
||||
// Logger.e(TAG, "errorMsg : " + errorMsg);
|
||||
// }
|
||||
// });
|
||||
});
|
||||
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(new IMoGoTokenCallback() {
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.google.gson.Gson;
|
||||
import com.mogo.cloud.live.constant.LiveConstant;
|
||||
import com.mogo.cloud.live.listener.IRequestLiveListener;
|
||||
import com.mogo.cloud.live.model.BaseData;
|
||||
import com.mogo.cloud.live.model.LiveCameraPush;
|
||||
import com.mogo.cloud.live.model.LivePush;
|
||||
import com.mogo.cloud.live.model.LiveReceive;
|
||||
import com.mogo.cloud.live.network.LiveApiServer;
|
||||
@@ -201,17 +200,13 @@ public class RequestLiveManager {
|
||||
* 请求服务器查看特定设备路口直播
|
||||
*
|
||||
* @param cameraId 设备id
|
||||
* @param lat 纬度
|
||||
* @param lon 经度
|
||||
* @param requestLiveListener {@link IRequestLiveListener}
|
||||
*/
|
||||
public void requestDesignativeIntersectionLive(int cameraId, double lat, double lon, IRequestLiveListener requestLiveListener) {
|
||||
public void requestDesignativeIntersectionLive(String cameraId, IRequestLiveListener requestLiveListener) {
|
||||
Gson gson = new Gson();
|
||||
String sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
LiveCameraPush livePush = new LiveCameraPush(cameraId, lat, lon);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("data", gson.toJson(livePush));
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("unitSn", cameraId);
|
||||
liveApiServer.getDesignativeIntersectionLive(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.mogo.cloud.live.model;
|
||||
|
||||
public class LiveCameraPush {
|
||||
|
||||
private int id; //摄像头id
|
||||
private double lat; //纬度
|
||||
private double lon; //经度
|
||||
|
||||
public LiveCameraPush(int id, double lat, double lon) {
|
||||
this.id = id;
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LiveCameraPush{" +
|
||||
"id=" + id +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,13 @@ import com.mogo.cloud.live.model.LiveReceive;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
/**
|
||||
* 直播功能使用到的接口
|
||||
@@ -47,10 +51,8 @@ public interface LiveApiServer {
|
||||
/**
|
||||
* 获取固定路口摄像头直播Url
|
||||
*
|
||||
* @param designativeIntersectionLiveMap 请求数据
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("")
|
||||
Observable<BaseData<LiveReceive>> getDesignativeIntersectionLive(@FieldMap Map<String, String> designativeIntersectionLiveMap);
|
||||
@GET("mec-etl-server/device/unit/camera/live")
|
||||
Observable<BaseData<LiveReceive>> getDesignativeIntersectionLive(@QueryMap Map<String, Object> parameters);
|
||||
}
|
||||
|
||||
@@ -67,13 +67,11 @@ public class MoGoAiCloudTrafficLive {
|
||||
* 查看指定路口摄像头直播
|
||||
*
|
||||
* @param cameraId 设备id
|
||||
* @param lat 纬度
|
||||
* @param lon 经度
|
||||
* @param callBack {@link ITrafficIntersectionLiveCallBack}直播回调
|
||||
*/
|
||||
public static void viewDesignativeIntersectionLive(int cameraId, double lat, double lon, ITrafficIntersectionLiveCallBack callBack) {
|
||||
public static void viewDesignativeIntersectionLive(String cameraId, ITrafficIntersectionLiveCallBack callBack) {
|
||||
try {
|
||||
TrafficLiveCurrentManager.getInstance().viewDesignativeIntersectionLive(cameraId, lat, lon, callBack);
|
||||
TrafficLiveCurrentManager.getInstance().viewDesignativeIntersectionLive(cameraId, callBack);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, " viewDesignativeIntersectionLive error : " + e);
|
||||
callBack.onError(e != null ? e.getMessage() : "check input param");
|
||||
|
||||
@@ -155,14 +155,11 @@ public class TrafficLiveCurrentManager
|
||||
});
|
||||
}
|
||||
|
||||
public void viewDesignativeIntersectionLive(int cameraId, double lat, double lon, ITrafficIntersectionLiveCallBack callBack) throws Exception {
|
||||
if (lat == 0.0 || lon == 0.0) {
|
||||
throw new Exception("param lat and lon can not be 0.0f");
|
||||
public void viewDesignativeIntersectionLive(String cameraId, ITrafficIntersectionLiveCallBack callBack) throws Exception {
|
||||
if (TextUtils.isEmpty(cameraId)) {
|
||||
throw new Exception("param cameraId can not be null");
|
||||
}
|
||||
if (cameraId < 0) {
|
||||
throw new Exception("param bearing can not less than 0");
|
||||
}
|
||||
requestLiveManager.requestDesignativeIntersectionLive(cameraId, lat, lon, new IRequestLiveListener() {
|
||||
requestLiveManager.requestDesignativeIntersectionLive(cameraId, new IRequestLiveListener() {
|
||||
@Override
|
||||
public void onSuccess(String liveUrl) {
|
||||
callBack.liveUrlResult(liveUrl);
|
||||
|
||||
Reference in New Issue
Block a user