2025年pron网站制作遇到的问题

pron网站制作遇到的问题pron 我在模板之家 下载了前端模板 现在最大的问题是视频文件该放在那里 1 第一种 放在服务器中 用外网服务器制作 花费一个月 1000 多 太贵 pass 2 第二种 放在七牛云 或者 oss 中 弊端太贵 玩不起 3 第三种 放在优酷 问题放在优酷的 pron 文件要审核 没办法实现 4 第四种 放在本地的硬盘 启动服务器使用 javaIO 流读取 上架使用花生壳 5 第五种

大家好,我是讯享网,很高兴认识大家。

pron 我在模板之家 下载了前端模板
现在最大的问题是视频文件该放在那里

1.第一种 放在服务器中 用外网服务器制作 花费一个月1000多 太贵 pass
2.第二种 放在七牛云 或者oss中 弊端太贵 玩不起
3.第三种 放在优酷 问题放在优酷的pron文件要审核 没办法实现
4.第四种 放在本地的硬盘 启动服务器使用 javaIO流读取 上架使用花生壳
5.第五种 直接解析人家的网站 问题 :MP4文件层层加密 以我目前的水平根本不可能解开

现在看来就第四种方式 能够使用


讯享网

compoent层

 import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; import org.springframework.stereotype.Component; import org.springframework.web.servlet.resource.ResourceHttpRequestHandler; import javax.servlet.http.HttpServletRequest; import java.nio.file.Path; @Component public class Compoent extends ResourceHttpRequestHandler { 
    public final static String ATTR_FILE = "NON-STATIC-FILE"; @Override protected Resource getResource(HttpServletRequest request) { 
    final Path filePath = (Path) request.getAttribute(ATTR_FILE); return new FileSystemResource(filePath); } } 

讯享网

controller层

讯享网@RequestMapping("static") @AllArgsConstructor public class conntrollerMP4 { 
    private final Compoent nonStaticResourceHttpRequestHandler; @GetMapping("/video") public void videoPreview(HttpServletRequest request, HttpServletResponse response) throws Exception { 
    //假如我把视频1.mp4放在了static下的video文件夹里面 //sourcePath 是获取resources文件夹的绝对地址 //realPath 即是视频所在的磁盘地址 String realPath="D:\\Users\\19835\\Desktop\\a.mp4"; Path filePath = Paths.get(realPath); if (Files.exists(filePath)) { 
    String mimeType = Files.probeContentType(filePath); if (!StringUtils.isEmpty(mimeType)) { 
    response.setContentType(mimeType); } request.setAttribute(Compoent.ATTR_FILE, filePath); nonStaticResourceHttpRequestHandler.handleRequest(request, response); } else { 
    response.setStatus(HttpServletResponse.SC_NOT_FOUND); response.setCharacterEncoding(StandardCharsets.UTF_8.toString()); } } } 
小讯
上一篇 2025-02-22 12:53
下一篇 2025-03-06 09:50

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/67712.html