ADD VideoPlayer component and implement video fetching functionality
This commit is contained in:
@@ -49,4 +49,18 @@ public class DownloadController {
|
||||
.contentType(MediaTypeFactory.getMediaType(resource).orElse(MediaType.APPLICATION_OCTET_STREAM))
|
||||
.body(resource);
|
||||
}
|
||||
|
||||
@GetMapping("/clip/{id}")
|
||||
public ResponseEntity<Resource> downloadClip(@PathVariable Long id) {
|
||||
Resource resource = downloadService.downloadClip(id);
|
||||
|
||||
if (resource == null || !resource.exists()) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=\"" + resource.getFilename() + "\"")
|
||||
.contentType(MediaTypeFactory.getMediaType(resource).orElse(MediaType.APPLICATION_OCTET_STREAM))
|
||||
.body(resource);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user