Java springboot的视频流

Java springboot的视频流,java,spring,spring-boot,spring-mvc,Java,Spring,Spring Boot,Spring Mvc,我使用SpringBoot并将压缩视频文件以二进制形式存储在Mongodb中,我能够检索并在html视频中显示视频。但是,我想从spring boot流式传输视频文件。提前谢谢 @RequestMapping(method = RequestMethod.GET, value = "coursebannervideo/{uid}/{id}") public void coursevideo (@PathVariable("uid")String u

我使用SpringBoot并将压缩视频文件以二进制形式存储在Mongodb中,我能够检索并在html视频中显示视频。但是,我想从spring boot流式传输视频文件。提前谢谢

@RequestMapping(method = RequestMethod.GET, value = "coursebannervideo/{uid}/{id}")
    public void coursevideo (@PathVariable("uid")String uid,@PathVariable("id")String id, HttpServletResponse response) 
    {
        
        Query query = new Query();
        
        
        query.addCriteria(Criteria.where("id").is(id));
         
        
         
        com.datavetz.ezlearn.mongodb.entity.course uc= ( com.datavetz.ezlearn.mongodb.entity.course)template.getObject(query, com.datavetz.ezlearn.mongodb.entity.course.class);
        
        
        byte[] b=this.decompressBytes(uc.getVideo().getData());
        
        InputStream in = new ByteArrayInputStream(b);
        response.setContentType("video/mp4");
        try {
            IOUtils.copy(in, response.getOutputStream());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        
    }