2016-08-01 8 views
2

Spring Restful Web Servicesからビデオを読み込もうとしています。 私のWebサービスはSpringBoot(tomcat)で起動され、私のHTMLはapache http serverにロードされます。Spring RESTful Webサービスでビデオを見る方法

私はビデオを見たりダウンロードすることはできますが、ビデオのカスタム時にジャンプすることはできません。 この問題は、ビデオがWebサービス(src = "http:// localhost:8080/maVideo")からアクセス可能な場合には存在しますが、ビデオがApacheサーバーからアクセス可能な場合は存在しません(src = "media/maVideo ")。

これは私のJavaコードです:

@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> 

この問題を知っていますか?

答えて

関連する問題