2
Spring Restful Web Services에서 비디오를 읽으려고합니다. 내 웹 서비스가 SpringBoot (tomcat)로 시작되고 내 html이 apache http 서버에로드됩니다.Spring RESTful 웹 서비스로 비디오를 보는 방법
비디오를 보거나 다운로드 할 수는 있지만 비디오의 사용자 정의 시간에 이동할 수는 없습니다. 웹 서비스 (src = "http : // localhost : 8080/maVideo")에서 비디오에 액세스 할 수 있지만 아파치 서버에서 비디오에 액세스 할 수없는 경우에는 문제가 발생합니다 (src = "media/maVideo ").
이 내 자바 코드 :
@CrossOrigin
@RequestMapping(value = "/videoSimple/{hash}", method = RequestMethod.GET, headers = "Accept=application/media")
public ResponseEntity<InputStreamResource> videoSimple(final HttpSession session, @PathVariable final String hash) throws IOException {
final String fileName = "/4_videoToto.mp4";
final ClassPathResource classPathResource = new ClassPathResource("medias/" + fileName);
final HttpHeaders headers = createHttpHeaders(fileName, classPathResource);
final ResponseEntity<InputStreamResource> response = new ResponseEntity<>(new InputStreamResource(classPathResource.getInputStream()), headers, HttpStatus.OK);
return response;
}
이 내 HTML 코드입니다.
<video id="video_telechargeable" width="360" height="250" controls>
<source src="http://localhost:8080/maVideo" type="video/mp4">
</video>
이 문제를 알고 계십니까?