package com.whyc.controller;
|
|
import com.whyc.dto.Response;
|
import com.whyc.dto.Response4Http;
|
import com.whyc.service.VideoService;
|
import io.swagger.annotations.Api;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
|
/**
|
* 摄像头的存储逻辑分为如下步骤:
|
* 1.程序启动时,获取所有的视频流id,并openRtpServer来开启流,执行startRecord来启动录制,自动1个小时保存一次录像.
|
* 2.录像的保存路径映射到http url中,可通过http获取mp4
|
* 3.每秒钟检测所有的视频流 是否 开启状态是否异常,如果异常,重新开启流
|
*/
|
@RestController
|
@RequestMapping("video")
|
@Api(tags = "摄像头视频")
|
public class VideoController {
|
|
@Autowired
|
private VideoService service;
|
|
@GetMapping("getVideoStreamIds")
|
public Response4Http getVideoStreamIds() {
|
return service.getVideoStreamIds();
|
}
|
|
@GetMapping("startRecord")
|
public Response4Http startRecord(String streamId) {
|
return service.startRecord(streamId);
|
}
|
|
@GetMapping("stopRecord")
|
public Response4Http<String> stopRecord(String streamId) {
|
return service.stopRecord(streamId);
|
}
|
|
@GetMapping("getMp4RecordFile")
|
public Response4Http<String> getMp4RecordFile(String streamId,String period){
|
return service.getMp4RecordFile(streamId,period);
|
}
|
|
}
|