1.@GetMapping("/pushStreamStatus")推流回调接口中,流状态回调 关闭状态发送数据表不一致的情况,将process方法中的setRecordType方法注释掉。未排查对其他数据的影响。

2.保存现场和默认鉴权时间修改为1年。rmtp格式正常,其他两个有待测试
3.	@GetMapping("/streamInfo")获取流信息接口,添加权限校验,必须要有live:livescene:stream:showUrl权限才能获取播流地址
This commit is contained in:
2210088963 2025-01-14 09:03:35 +08:00
parent 1f31d0defd
commit 1295daf3aa
7 changed files with 38 additions and 25 deletions

View File

@ -21,6 +21,7 @@ import com.platform.modules.live.vo.LiveInfoVo;
import com.platform.modules.live.vo.SceneEntityVo;
import com.platform.modules.sys.controller.AbstractController;
import com.platform.modules.sys.entity.SysTenantEntity;
import com.platform.modules.sys.entity.SysUserEntity;
import com.platform.modules.sys.service.impl.SysTenantServiceImpl;
import com.platform.plugs.common.rpc.RpcResponse;
import io.swagger.annotations.Api;
@ -433,7 +434,7 @@ public class LiveSceneController extends AbstractController {
if (null == id) {
return R.error("参数错误");
}
return liveSceneService.streamInfo(id);
return liveSceneService.streamInfo(id);
}

View File

@ -12,7 +12,7 @@ import java.util.Date;
/**
* 现场直播信息表
*
*
* @author zj
* @date 2019-02-19 14:25:45
*/
@ -45,6 +45,7 @@ public class LiveSceneLiveInfoEntity implements Serializable {
private String infoName;
/**
* 流类型,1:手机2摄像机
* 类型,1:记者2直播间,3:第三方拉流
*/
@ApiModelProperty(value = "类型,1:记者2直播间,3:第三方拉流")
private Integer infoType;
@ -67,22 +68,22 @@ public class LiveSceneLiveInfoEntity implements Serializable {
@ApiModelProperty(value = " 推流结束时间")
private Date pushEnd;
/**
*
*
*/
@ApiModelProperty(value = " pushDomain")
private String pushDomain;
/**
*
*
*/
@ApiModelProperty(value = " liveDomain")
private String liveDomain;
/**
*
*
*/
@ApiModelProperty(value = " appName")
private String appName;
/**
*
*
*/
@ApiModelProperty(value = " streamName")
private String streamName;
@ -100,7 +101,7 @@ public class LiveSceneLiveInfoEntity implements Serializable {
@ApiModelProperty(value = "是否转写语音文字0不转文字1转文字")
private Integer isTxt;
@ApiModelProperty(value = "排序,数字越大,排序越靠前")
private Integer priority;
/**
@ -108,7 +109,7 @@ public class LiveSceneLiveInfoEntity implements Serializable {
* */
@ApiModelProperty(value = "租户ID")
private Long tenantId;
/**
* 拉流开始时间
*/
@ -121,7 +122,7 @@ public class LiveSceneLiveInfoEntity implements Serializable {
@ApiModelProperty(value = " 拉流结束时间")
@TableField(strategy=FieldStrategy.IGNORED)
private Date pullEnd;
@ApiModelProperty(value = "拉流地址")
@TableField(exist = false)
private String pullUrl;

View File

@ -38,6 +38,8 @@ import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -282,7 +284,7 @@ public class LiveSceneServiceImpl extends ServiceImpl<LiveSceneDao, LiveSceneEnt
//设置结束时间为直播时间后一天
Calendar instance = Calendar.getInstance();
instance.setTime(liveScene.getLiveStart());
instance.add(Calendar.DATE, 1);
instance.add(Calendar.YEAR, 1);
liveScene.setLiveEnd(instance.getTime());
//将现场类型设置为5混合类型
@ -1406,7 +1408,15 @@ public class LiveSceneServiceImpl extends ServiceImpl<LiveSceneDao, LiveSceneEnt
// 20200316_Mxy 图片压缩
liveInfoVo.setTitleImageShow(MaterialUtils.getMaterialUrl(compressImage(infoEntity.getTitleImage()), foreignProperties.getMediaurl()));
// liveInfoVo.setTitleImageShow(MaterialUtils.getMaterialUrl(infoEntity.getTitleImage(), foreignProperties.getMediaurl()));
return R.ok().put("liveInfoVo", liveInfoVo);
//无权限无法查看拉流信息
Subject currentUser = SecurityUtils.getSubject();
if (!currentUser.isPermitted("live:livescene:stream:showUrl")) {
liveInfoVo.setPlayUrlRmtp(null);
liveInfoVo.setPlayUrlHls(null);
liveInfoVo.setPlayUrlFlv(null);
}
return R.ok().put("liveInfoVo", liveInfoVo);
}
@Override

View File

@ -91,7 +91,7 @@ public class LiveStreamStatusServiceImpl extends ServiceImpl<LiveStreamStatusDao
} else {
LiveSceneLiveInfoEntity liveSceneLiveInfoEntity = liveSceneLiveInfoService.findLiveInfoByPushDomainAppAndStream(liveStreamStatusEntity.getApp(), liveStreamStatusEntity.getAppName(), liveStreamStatusEntity.getStreamName());
if (liveSceneLiveInfoEntity != null) {//直播间流修改状态及时间
if (liveSceneLiveInfoEntity != null) {//直播间流修改状态及时间开播时间和状态关播时间和状态
liveSceneLiveInfoService.updateLiveState(liveSceneLiveInfoEntity, liveStreamStatusEntity.getAction(), liveStreamStatusEntity.getTime());
// 若为记者流则修改记者状态为推流状态
String key = RedisContants.REPORTER_PUSH_STATE + liveSceneLiveInfoEntity.getUserId();
@ -161,7 +161,7 @@ public class LiveStreamStatusServiceImpl extends ServiceImpl<LiveStreamStatusDao
liveSceneRecordEntity.setTitleImage(scene.getTitleImage());
// 设置回顾类型
liveSceneRecordEntity.setRecordType(LiveConstants.RecordType.FAST_RECORD);
// liveSceneRecordEntity.setRecordType(LiveConstants.RecordType.FAST_RECORD);
liveSceneRecordService.insert(liveSceneRecordEntity);
}
}

View File

@ -8,7 +8,7 @@ import org.apache.commons.lang.StringUtils;
import com.platform.plugs.live.config.LiveStreamConfig;
/**
/**
* @Author TONG
* @Date 2019/2/19 15:22
**/
@ -23,8 +23,8 @@ public class StreamAddressUtils {
private static final String RTMP_URL_FORMAT = "rtmp://%s/%s/%s?auth_key=%d-%s-0-%s";
private static final String HTTP_URL_FORMAT = "https://%s/%s/%s?auth_key=%d-%s-0-%s";
private static final String QUERY_TIMELINE = "http://%s/openapi/timeline/query?aliyunols=on&app=%s&stream=%s&format=ts&lhs_start_unix_s_0=%d&lhs_end_unix_s_0=%d&auth_key=%d-%s-0-%s";
private static final String QUERY_TIMELINE_MD5_KEY_FORMAT = "/openapi/timeline/query-%d-%s-0-%s";
@ -61,7 +61,7 @@ public class StreamAddressUtils {
};
return liveUrls;
}
/**
* 生成直播时移地址
*
@ -77,7 +77,7 @@ public class StreamAddressUtils {
String md5key = String.format(MD5_KEY_FORMAT, appName, streamName+ ".m3u8", time, uuid, streamConfig.getLiveKey());
return String.format(HTTP_URL_FORMAT, streamConfig.getLiveDomain(), appName, streamName + ".m3u8", time, uuid, DigestUtils.md5Hex(md5key.getBytes()));
}
/**
* 生成直播时移时间轴查询地址
* @param startDate
@ -156,7 +156,7 @@ public class StreamAddressUtils {
// LiveStreamConfig streamConfig = new LiveStreamConfig("", "", "live.zhongkedongxin.com", "iim00IV2CF");
//
//
// int startDate = 1583376633;
// int endDate = 1583291065;
// String appName = "3WFhLgzE";
@ -167,7 +167,7 @@ public class StreamAddressUtils {
// String md5key = String.format(MD5_KEY_FORMAT, appName, streamName+ ".m3u8", time, uuid, streamConfig.getLiveKey());
// String url = generateUrl(new Date(Long.valueOf("1583291065000")), new Date(Long.valueOf(endDate)), appName, streamName + ".m3u8", streamConfig.getLiveDomain(), streamConfig.getLiveKey(), 259200, HTTP_URL_FORMAT);
// String url2 = String.format(HTTP_URL_FORMAT, streamConfig.getLiveDomain(), appName, streamName + ".m3u8", time, uuid, DigestUtils.md5Hex(md5key.getBytes()));
//
//
// streamConfig.setLiveAuthTime(30 * 60);
// String[] urls = StreamAddressUtils.generateLiveUrl(new Date(), null, "test", "test", streamConfig);
// for(String url : urls)

View File

@ -8,18 +8,19 @@ zkdx:
push:
domain-name: push.jay99.cn
key: xIc6QB1oxQp7V9AF
auth-time: 43200
auth-time: 31536000 #默认设置为一年
live:
domain-name: live.jay99.cn
key: 5H2gh53QSthMyqSU
auth-time: 43200 #单位秒
media:
auth-time: 31536000 #默认设置为一年
# auth-time: 43200 #单位秒
media: #点播
domain-name: record.jay99.cn
bucket: outin-d4f2e981c98411ef9ade00163e1a65b6
endpoint: oss-cn-shanghai.aliyuncs.com
apiRegionId: cn-shanghai
templateGroupId: 3798e90f4795f9661831e5c5d10ae01d
record:
record: #录制
domain-name: push.jay99.cn
vod-transcode-groupId-mp4: 3798e90f4795f9661831e5c5d10ae01d
vod-transcode-groupId-mp3: d9050d459d7fb2e8c755e34c27f26284

View File

@ -25,4 +25,4 @@
</resultMap>
</mapper>
</mapper>