video标签SRC请求播放视频,发送两次请求

如题,video标签SRC请求视频,发送两次请求,且状态一直都是pending,感觉像是阻塞了,但是后台接口加锁了的
图片说明

图片说明

    @GetMapping("visitVedio")
    @ResponseBody
    public synchronized void visitVedio(String vedioName, HttpServletRequest request, HttpServletResponse response) throws IOException {
        String path;
        InputStream inputStream = null;
        BufferedInputStream bufferedInputStream = null;
        BufferedOutputStream bufferedOutputStream = null;
        try {
            path = "vedio";
            inputStream = FtpClientUtil.readFile(vedioName, path);
            bufferedInputStream = new BufferedInputStream(inputStream);

            bufferedOutputStream = new BufferedOutputStream(response.getOutputStream());
            byte[] buf = new byte[1024 * 1024];
            int length = 0;
            while ((length = bufferedInputStream.read(buf)) != -1) {
                bufferedOutputStream.write(buf, 0, length);
                bufferedOutputStream.flush();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                inputStream.close();
                bufferedInputStream.close();
                bufferedOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

FTP工具类读取流的方法如下

public static InputStream readFile(String fileName, String remotePath) throws IOException {
//        FTPClient FTP_CLIENT = new FTPClient();
        try {
            FTP_CLIENT.connect(FTP_URL, Integer.parseInt(FTP_PORT));
            FTP_CLIENT.setConnectTimeout(300 * 1000);
            FTP_CLIENT.login(FTP_USER, FTP_PWD);
            FTP_CLIENT.setControlEncoding(FILE_ENCODING);
            // 设置文件传输类型为二进制
            FTP_CLIENT.setFileType(FTP_CLIENT.BINARY_FILE_TYPE);
            FTP_CLIENT.enterLocalPassiveMode();
            // 获取ftp登录应答代码
            int reply = FTP_CLIENT.getReplyCode();
            // 验证是否登陆成功
            if (!FTPReply.isPositiveCompletion(reply)) {
                FTP_CLIENT.disconnect();
            }
            FTP_CLIENT.changeWorkingDirectory(FTP_FILE_PATH);
            FTP_CLIENT.changeWorkingDirectory(remotePath);
            FTP_CLIENT.setBufferSize(1024 * 1024 * 50);
            InputStream inputStream = FTP_CLIENT.retrieveFileStream(fileName);
            FTP_CLIENT.logout();
            return inputStream;
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (FTP_CLIENT.isConnected()) {
                try {
                    FTP_CLIENT.disconnect();
                } catch (Exception ioe) {
                    ioe.printStackTrace();
//                    logger.error("读取文件,FTP服务器关闭异常!");
                }
            }
        }
        return null;
    }

你的思路根本就不对
ftp不支持streamed,也就是说,必须等ftp下载视频完成 readFile 返回,你的web服务器才能向客户端返回。这能不卡死才怪。