阿里云服务器显示视频的过程

首先只需要在pom文件中添加打包方式在这里插入图片描述
然后在这里插入图片描述
点击这个就会生成在项目下生成target文件夹,下面就有war包

然后xshell连接服务器

先搞jdk环境

在/etc/profile中配置一下

在这里插入图片描述
然后运行下载tomcat启动

出现找不到setclasspath.sh就输入 unset CATALINA_HOME

如果访问不到tomcat 就吧服务器的防火墙给8080加入白名单

还要在阿里云控制台打开8080端口!!!

war包放在tomcat的webapps下

./startup.sh启动tomcat ./shutdown.sh关闭tomcat

在html页面显示视频

html页面
<video width="1000" height="700" controls="controls">
    <source src="three" type="video/mp4">

控制器
@RequestMapping("three")
    public void c(HttpServletResponse response) throws IOException {
    
    
        File file = new File("/usr/local/2.mp4");//linux路径
        FileInputStream fileInputStream = new FileInputStream(file);
        response.addHeader("Content-Type","video/mp4;charset=UTF-8");
        IOUtils.copy(fileInputStream,response.getOutputStream());
        response.flushBuffer();
        }

Guess you like

Origin blog.csdn.net/m0_48358308/article/details/108815078