sdk add conference rtp forward api
This commit is contained in:
@@ -46,14 +46,22 @@ public class ConferenceAdmin {
|
||||
return AdminHttpUtils.httpJsonPost(path, conferenceRoomId, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> rtpForward(String roomId, String userId, String rtpHost, int rtpPort) throws Exception {
|
||||
public static IMResult<Void> rtpForward(String roomId, String userId, String rtpHost, int audioPort, int audioPt, long audioSSRC, int videoPort, int videoPt, long videoSSRC) throws Exception {
|
||||
String path = APIPath.Conference_Rtp_Forward;
|
||||
PojoConferenceRtpForwardReq req = new PojoConferenceRtpForwardReq();
|
||||
req.roomId = roomId;
|
||||
req.publisherId = userId;
|
||||
req.host = rtpHost;
|
||||
req.audioPort = rtpPort;
|
||||
req.videoPort = rtpPort;
|
||||
PojoConferenceRtpForwardReq req = new PojoConferenceRtpForwardReq(roomId, userId, rtpHost, audioPort, audioPt, audioSSRC, videoPort, videoPt, videoSSRC);
|
||||
return AdminHttpUtils.httpJsonPost(path, req, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> stopRtpForward(String roomId, String userId, long streamId) throws Exception {
|
||||
String path = APIPath.Conference_Stop_Rtp_Forward;
|
||||
PojoConferenceStopRtpForwardReq req = new PojoConferenceStopRtpForwardReq(roomId, userId, streamId);
|
||||
return AdminHttpUtils.httpJsonPost(path, req, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<PojoConferenceRtpForwarders> listRtpForwarders(String roomId) throws Exception {
|
||||
String path = APIPath.Conference_List_Rtp_Forward;
|
||||
PojoConferenceRoomId req = new PojoConferenceRoomId();
|
||||
req.roomId = roomId;
|
||||
return AdminHttpUtils.httpJsonPost(path, req, PojoConferenceRtpForwarders.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1709,7 +1709,26 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
IMResult<Void> rtpForwardResult = ConferenceAdmin.rtpForward("5156250396", "lhgqmws2k", "192.168.1.81", 8000);
|
||||
IMResult<PojoConferenceRtpForwarders> listForwarderResult = ConferenceAdmin.listRtpForwarders("6366963312");
|
||||
if(listForwarderResult == null || listForwarderResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("list rtp forward failure");
|
||||
} else {
|
||||
System.out.println("list rtp forward success");
|
||||
listForwarderResult.getResult().forwarders.forEach(rtpForwarder -> rtpForwarder.streams.forEach(rtpStream -> {
|
||||
try {
|
||||
IMResult<Void> stopRtpForwardResult = ConferenceAdmin.stopRtpForward(listForwarderResult.getResult().roomId, rtpForwarder.publisherId, rtpStream.streamId);
|
||||
if(stopRtpForwardResult == null || stopRtpForwardResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("rtp forward stop failure");
|
||||
} else {
|
||||
System.out.println("rtp forward stop success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
IMResult<Void> rtpForwardResult = ConferenceAdmin.rtpForward("6366963312", "cygqmws2k", "192.168.1.81", 10000, 111, 0, 10005, 98, 0);
|
||||
if(rtpForwardResult == null || rtpForwardResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("rtp forward failure");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user