|  | @@ -44,6 +44,7 @@ import com.ym.mec.common.page.PageInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.PageUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.WrapperUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.tenant.TenantContextHolder;
 | 
	
		
			
				|  |  | +import com.ym.mec.im.ImFeignService;
 | 
	
		
			
				|  |  |  import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.collection.MapUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.date.DateUtil;
 | 
	
	
		
			
				|  | @@ -114,6 +115,9 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private LivePluginContext livePluginContext;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ImFeignService imFeignService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      //待替换的变量
 | 
	
		
			
				|  |  |      public static final String USER_ID = "${userId}";
 | 
	
		
			
				|  |  |      public static final String ROOM_UID = "${roomUid}";
 | 
	
	
		
			
				|  | @@ -1314,8 +1318,6 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |          if (intEquals(roomSpeakerInfo.getWhetherVideo(), 0)) {
 | 
	
		
			
				|  |  |              //开始录制视频
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  | -//                imFeignService.startRecord(roomUid, videoResolution);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |                  // 查询房间信息
 | 
	
		
			
				|  |  |                  ImLiveBroadcastRoomVo imLiveBroadcastRoomVo = getImLiveBroadcastRoomVo(roomUid);
 | 
	
		
			
				|  |  |                  if (Objects.isNull(imLiveBroadcastRoomVo)) {
 | 
	
	
		
			
				|  | @@ -1329,19 +1331,23 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                // 直播开始时间
 | 
	
		
			
				|  |  | -                DateTime dateTime = new DateTime(imLiveBroadcastRoomVo.getLiveStartTime());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                RTCRoom.RecordResp recordResp = pluginService.rtcRoomRecordStart(RTCRequest.RecordStart.builder()
 | 
	
		
			
				|  |  | -                        .startTime(dateTime.plusMillis(5).getMillis() / 1000)
 | 
	
		
			
				|  |  | -                        .endTime(dateTime.plusDays(1).getMillis() / 1000)
 | 
	
		
			
				|  |  | -                        .streamName(MessageFormat.format("{0}_{1}", imLiveBroadcastRoomVo.getRoomUid(), String.valueOf(imLiveBroadcastRoomVo.getSpeakerId())))
 | 
	
		
			
				|  |  | -                        .sessionId(rtcRoom.getSessionId())
 | 
	
		
			
				|  |  | -                        .config(RTCRequest.RecordConfig.builder()
 | 
	
		
			
				|  |  | -                                .videoResolution(videoResolution)
 | 
	
		
			
				|  |  | -                                .build())
 | 
	
		
			
				|  |  | -                        .build());
 | 
	
		
			
				|  |  | -                log.info("startLive 直播录录开启: recordResp={}", JSON.toJSONString(recordResp));
 | 
	
		
			
				|  |  | +                if (imLiveBroadcastRoomVo.getServiceProvider().equals(RongCloudLivePlugin.PLUGIN_NAME)) {
 | 
	
		
			
				|  |  | +                    imFeignService.startRecord(roomUid, videoResolution);
 | 
	
		
			
				|  |  | +                } else if (imLiveBroadcastRoomVo.getServiceProvider().equals(TencentCloudLivePlugin.PLUGIN_NAME) && roomSpeakerInfo.getVideoTemplate() == 0) {
 | 
	
		
			
				|  |  | +                    // 直播开始时间
 | 
	
		
			
				|  |  | +                    DateTime dateTime = new DateTime(imLiveBroadcastRoomVo.getLiveStartTime());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    RTCRoom.RecordResp recordResp = pluginService.rtcRoomRecordStart(RTCRequest.RecordStart.builder()
 | 
	
		
			
				|  |  | +                           .startTime(dateTime.getMillis() )
 | 
	
		
			
				|  |  | +                           .endTime(dateTime.plusDays(1).getMillis() )
 | 
	
		
			
				|  |  | +                           .streamName(MessageFormat.format("{0}_{1}", imLiveBroadcastRoomVo.getRoomUid(), String.valueOf(imLiveBroadcastRoomVo.getSpeakerId())))
 | 
	
		
			
				|  |  | +                           .build());
 | 
	
		
			
				|  |  | +                    roomSpeakerInfo.setVideoTemplate(1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    log.info("startLive 直播录录开启: recordResp={}", JSON.toJSONString(recordResp));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              } catch (Exception e) {
 | 
	
		
			
				|  |  |                  log.error("startRecord error: {}", e.getMessage());
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -1403,12 +1409,10 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                // 若返回的sessionId为空,则手动查询录制任务taskId
 | 
	
		
			
				|  |  | -                if (StringUtils.isBlank(rtcRoom.getSessionId())) {
 | 
	
		
			
				|  |  | -                    // FIXME: 获取腾讯云直播录制任务Id
 | 
	
		
			
				|  |  | +                // 融云停止录制 腾讯云录制在直播间销毁时自动停止
 | 
	
		
			
				|  |  | +                if (imLiveBroadcastRoomVo.getServiceProvider().equals(RongCloudLivePlugin.PLUGIN_NAME)) {
 | 
	
		
			
				|  |  | +                    pluginService.rtcRoomRecordStop(rtcRoom.getSessionId());
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                pluginService.rtcRoomRecordStop(rtcRoom.getSessionId());
 | 
	
		
			
				|  |  |              } catch (Exception e) {
 | 
	
		
			
				|  |  |                  log.error("stopRecord error: {}", e.getMessage());
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -1520,8 +1524,10 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |              // 创建直播间IM群
 | 
	
		
			
				|  |  |              pluginService.chatRoomCreate(room.getRoomUid(), room.getRoomTitle(),sysUser.getId().toString());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +            Boolean whetherVideoFlag = getRoomConfig(room.getRoomConfig()).map(o -> o.getWhether_video() == 0).orElse(true);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              // 腾讯云直播,提前生成录制规则
 | 
	
		
			
				|  |  | -            if (room.getServiceProvider().equals(TencentCloudLivePlugin.PLUGIN_NAME)) {
 | 
	
		
			
				|  |  | +            if (room.getServiceProvider().equals(TencentCloudLivePlugin.PLUGIN_NAME) && whetherVideoFlag) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  DateTime now = DateTime.now();
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1567,9 +1573,12 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |          if (video) {
 | 
	
		
			
				|  |  |              //可以录制视频
 | 
	
		
			
				|  |  |              speakerInfo.setWhetherVideo(0);
 | 
	
		
			
				|  |  | +            // 设置模板
 | 
	
		
			
				|  |  | +            speakerInfo.setVideoTemplate(1);
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              //不可以录制视频
 | 
	
		
			
				|  |  |              speakerInfo.setWhetherVideo(1);
 | 
	
		
			
				|  |  | +            speakerInfo.setVideoTemplate(0);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          speakerInfo.setOs(room.getOs());
 | 
	
		
			
				|  |  |          //写入主讲人信息
 | 
	
	
		
			
				|  | @@ -2258,6 +2267,17 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |          //播出端-  pc网页端 移动端mobile
 | 
	
		
			
				|  |  |          private String os = "pc";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        // 腾讯视频模板 0: 没有 1:有
 | 
	
		
			
				|  |  | +        private Integer videoTemplate;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public Integer getVideoTemplate() {
 | 
	
		
			
				|  |  | +            return videoTemplate;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public void setVideoTemplate(Integer videoTemplate) {
 | 
	
		
			
				|  |  | +            this.videoTemplate = videoTemplate;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          public Integer getSpeakerId() {
 | 
	
		
			
				|  |  |              return speakerId;
 | 
	
		
			
				|  |  |          }
 |