|
@@ -236,7 +236,6 @@ public class IMHelper {
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
- @Async
|
|
|
|
public void startRecord(String roomId, Long registrationId, List<RoomMember> roomMembers) throws Exception {
|
|
public void startRecord(String roomId, Long registrationId, List<RoomMember> roomMembers) throws Exception {
|
|
if (roomId == null) {
|
|
if (roomId == null) {
|
|
throw new IllegalArgumentException("Paramer 'roomId' is required");
|
|
throw new IllegalArgumentException("Paramer 'roomId' is required");
|
|
@@ -268,26 +267,13 @@ public class IMHelper {
|
|
config.put("input",getInput(roomMembers));
|
|
config.put("input",getInput(roomMembers));
|
|
paramJson.put("config",config);
|
|
paramJson.put("config",config);
|
|
String body = paramJson.toJSONString();
|
|
String body = paramJson.toJSONString();
|
|
-
|
|
|
|
- HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/record/start.json", "application/json",roomId);
|
|
|
|
- httpHelper.setBodyParameter(body, conn);
|
|
|
|
- againRecord(conn,body,registrationId);
|
|
|
|
-
|
|
|
|
- /*IMApiResultInfo resultInfo = JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
|
|
|
|
- if(resultInfo.getResultCode() == 10000){
|
|
|
|
- redisTemplate.opsForValue().set(resultInfo.getRecordId(),registrationId.toString());
|
|
|
|
- }else {
|
|
|
|
- log.error("直播视频录制失败:body : {},resultInfo : {}",body,resultInfo);
|
|
|
|
- int i = 1;
|
|
|
|
- while (i<=3){
|
|
|
|
-
|
|
|
|
- i++;
|
|
|
|
- }
|
|
|
|
- }*/
|
|
|
|
|
|
+ againRecord(body,registrationId,roomId);
|
|
}
|
|
}
|
|
|
|
|
|
@Async
|
|
@Async
|
|
- public void againRecord(HttpURLConnection conn,String body,Long registrationId) throws Exception {
|
|
|
|
|
|
+ public void againRecord(String body,Long registrationId,String roomId) throws Exception {
|
|
|
|
+ HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/record/start.json", "application/json",roomId);
|
|
|
|
+ httpHelper.setBodyParameter(body, conn);
|
|
IMApiResultInfo resultInfo = JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
|
|
IMApiResultInfo resultInfo = JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
|
|
if(resultInfo.getResultCode() == 10000){
|
|
if(resultInfo.getResultCode() == 10000){
|
|
redisTemplate.opsForValue().set(resultInfo.getRecordId(),registrationId.toString());
|
|
redisTemplate.opsForValue().set(resultInfo.getRecordId(),registrationId.toString());
|
|
@@ -296,7 +282,9 @@ public class IMHelper {
|
|
int i = 1;
|
|
int i = 1;
|
|
while (i<=3){
|
|
while (i<=3){
|
|
Thread.sleep(5000l);
|
|
Thread.sleep(5000l);
|
|
- IMApiResultInfo imApiResultInfo = JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
|
|
|
|
|
|
+ HttpURLConnection connection = httpHelper.createIMRtcPostHttpConnection("/rtc/record/start.json", "application/json", roomId);
|
|
|
|
+ httpHelper.setBodyParameter(body, connection);
|
|
|
|
+ IMApiResultInfo imApiResultInfo = JSON.parseObject(httpHelper.returnResult(connection, body), IMApiResultInfo.class);
|
|
log.error("直播视频录制失败:resultInfo : {} 第{}次重试",imApiResultInfo,i);
|
|
log.error("直播视频录制失败:resultInfo : {} 第{}次重试",imApiResultInfo,i);
|
|
i++;
|
|
i++;
|
|
if(imApiResultInfo.getResultCode() == 10000){
|
|
if(imApiResultInfo.getResultCode() == 10000){
|