Posts

Showing posts from December, 2024

content v mabager in spring boot

  private static final ExecutorService executor = Executors . newFixedThreadPool ( 10 ) ; // Increase thread pool size if needed @GetMapping ( "/range/{videoId}" ) public CompletableFuture < ResponseEntity < Resource >> streamVideoRange ( @PathVariable ( "videoId" ) String videoId , @RequestHeader ( value = "Range" , required = false ) String range ) { return CompletableFuture . supplyAsync (() -> { // Your existing logic inside CompletableFuture to run asynchronously Path path = Paths . get ( ConfigConstants . VIDEO_STORAGE_DIR , "syllabus.mp4" ) ; long fileLength = path . toFile () . length () ; String contentType = "video/mp4" ; long rangeStart = 0 ; long rangeEnd = fileLength - 1 ; if ( range != null ) { String [] ranges = range . replace ( ...