|
|
@@ -1,15 +1,9 @@
|
|
|
package cn.reghao.tnb.file.app.controller;
|
|
|
|
|
|
-import org.springframework.core.io.InputStreamResource;
|
|
|
-import org.springframework.http.HttpHeaders;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.MediaType;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
+import cn.reghao.tnb.file.app.db.mapper.FileUrlMapper;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.io.ByteArrayInputStream;
|
|
|
-import java.io.OutputStream;
|
|
|
import java.io.RandomAccessFile;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Arrays;
|
|
|
@@ -21,10 +15,18 @@ import java.util.Arrays;
|
|
|
@RestController
|
|
|
@RequestMapping("/video")
|
|
|
public class VideoFileController {
|
|
|
+ private final FileUrlMapper fileUrlMapper;
|
|
|
+
|
|
|
+ public VideoFileController(FileUrlMapper fileUrlMapper) {
|
|
|
+ this.fileUrlMapper = fileUrlMapper;
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/playback")
|
|
|
- public void videoPlayer(@RequestParam("videoId") String videoId,
|
|
|
+ public void videoPlayer(@RequestParam("uploadId") String uploadId,
|
|
|
@RequestHeader(required = false) String range,
|
|
|
HttpServletResponse response) throws Exception {
|
|
|
+ fileUrlMapper.findByUploadId(uploadId);
|
|
|
+
|
|
|
String filePath = "/home/reghao/Downloads/mp4/test.mp4";
|
|
|
RandomAccessFile raf = new RandomAccessFile(filePath, "r");
|
|
|
long fileLength = raf.length();
|