| | |
| | |
|
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
| | | import com.ruoyi.common.annotation.Anonymous;
|
| | | import com.ruoyi.common.constant.HttpStatus;
|
| | | import com.ruoyi.common.core.controller.BaseController;
|
| | | import com.ruoyi.common.core.domain.AjaxResult;
|
| | | import com.ruoyi.common.core.domain.BaseEntity;
|
| | | import com.ruoyi.common.core.page.TableDataInfo;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.uuid.IdUtils;
|
| | | import com.ruoyi.media.domain.Config;
|
| | | import com.ruoyi.media.domain.Paths;
|
| | | import com.ruoyi.media.domain.StreamInfo;
|
| | | import com.ruoyi.media.domain.Vtdu;
|
| | | import com.ruoyi.media.domain.*;
|
| | | import com.ruoyi.media.service.IMediaService;
|
| | | import com.ruoyi.media.service.IVtduService;
|
| | | import io.swagger.annotations.Api;
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 移除拉流
|
| | | * 移除webrtc拉流
|
| | | */
|
| | | @ApiOperation("移除拉流")
|
| | | @ApiOperation("移除webrtc拉流")
|
| | | @ApiOperationSupport(order =4 )
|
| | | @PreAuthorize("@ss.hasPermi('media:stream:remove')")
|
| | | @DeleteMapping("/{sessionId}")
|
| | | public AjaxResult removePullStreamSession(@PathVariable String sessionId) {
|
| | | List<StreamInfo> pullStreamList = mediaService.getPullStreamList(1,1000);
|
| | | StreamInfo streamInfo = pullStreamList.stream()
|
| | | .filter(object -> object.getId().equals(sessionId))
|
| | | .collect(Collectors.toList()).get(0);
|
| | | switch (streamInfo.getSessionType()) {
|
| | | case "rtsp":
|
| | | return AjaxResult.success(mediaService.kickRtspSession(sessionId));
|
| | | case "webrtc":
|
| | | public AjaxResult removeWebrtcPullStreamSession(@PathVariable String sessionId) {
|
| | | return AjaxResult.success(mediaService.kickWebrtcSession(sessionId));
|
| | | case "rtmp":
|
| | | return AjaxResult.success(mediaService.kickRtmpSession(sessionId));
|
| | | }
|
| | | return AjaxResult.error();
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | /**
|
| | | * 按ID查询拉流详情
|
| | | */
|
| | | @GetMapping("/getRtspSessionById")
|
| | | @ApiOperation("按ID查询拉流详情")
|
| | | public AjaxResult getRtspSessionById(String sessionId) {
|
| | | List<StreamInfo> pullStreamList = mediaService.getPullStreamList(1,1000);
|
| | | StreamInfo streamInfo = pullStreamList.stream()
|
| | | .filter(object -> object.getId().equals(sessionId))
|
| | | .collect(Collectors.toList()).get(0);
|
| | | switch (streamInfo.getSessionType()) {
|
| | | case "rtsp":
|
| | | return AjaxResult.success(mediaService.getRtspSessionById(sessionId));
|
| | | case "rtmp":
|
| | | return AjaxResult.success(mediaService.getRtmpSessionById(sessionId));
|
| | | case "webrtc":
|
| | | @GetMapping("/getWebrtcSessionById")
|
| | | @ApiOperation("按ID查询webrtc拉流详情")
|
| | | public AjaxResult getWebrtcSessionById(String sessionId) {
|
| | | return AjaxResult.success(mediaService.getWebrtcSessionById(sessionId));
|
| | | }
|
| | | return AjaxResult.error();
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @ApiOperation("获取推流列表")
|
| | | @ApiOperationSupport(order = 6)
|
| | | public TableDataInfo getPushStreamList(Integer pageNum,Integer pageSize) {
|
| | | startPage();
|
| | | return getDataTable(mediaService.getPushStreamList(pageNum,pageSize));
|
| | | TableDataInfo tableDataInfo = mediaService.getPushStreamList(pageNum, pageSize);
|
| | | return tableDataInfo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取拉流列表
|
| | | * 获取WebRtc拉流列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('media:stream:list')")
|
| | | @GetMapping("/pullList")
|
| | | @ApiOperation("获取拉流列表")
|
| | | @GetMapping("/getPullWebrtcStreamList")
|
| | | @ApiOperation("获取WebRtc拉流列表")
|
| | | @ApiOperationSupport(order = 7)
|
| | | public TableDataInfo getPullStreamList(Integer pageNum,Integer pageSize) {
|
| | | startPage();
|
| | | return getDataTable(mediaService.getPullStreamList(pageNum,pageSize));
|
| | | public TableDataInfo getPullWebrtcStreamList(Integer pageNum, Integer pageSize) {
|
| | | return mediaService.getPullWebrtcStreamList(pageNum, pageSize);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取rtsp拉流列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('media:stream:list')")
|
| | | @GetMapping("/getPullRtspStreamList")
|
| | | @ApiOperation("获取rtsp拉流列表")
|
| | | @ApiOperationSupport(order = 8)
|
| | | public TableDataInfo getPullRtspStreamList(Integer pageNum, Integer pageSize) {
|
| | | return mediaService.getPullRtspStreamList(pageNum, pageSize);
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取rtmp拉流列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('media:stream:list')")
|
| | | @GetMapping("/getPullRtmpStreamList")
|
| | | @ApiOperation("获取rtmp拉流列表")
|
| | | @ApiOperationSupport(order = 9)
|
| | | public TableDataInfo getPullRtmpStreamList(Integer pageNum, Integer pageSize) {
|
| | | return mediaService.getPullRtmpStreamList(pageNum, pageSize);
|
| | | }
|
| | | }
|