whycxzp
2025-05-26 e7bd17e3a9377b0a513ff9e11f14c7b7dc7c383e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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);
    }
 
}