首页 > 解决方案 > 带有 thymleaf 视频播放任务的 Spring Boot

问题描述

在具有视频相关路径(如“H:/testing/1.mp4”)的数据库中,这些是用户上传的视频,然后我想在用户登录他的帐户时使用 spring boot 在 thymleaf 上播放这些视频我写了所有内容,直到获取用户相关数据“问题是如何播放 thymleaf 视频标签上的视频”请

控制器代码:

List<Postings> findByUserVideos = postingService.findByUserVideos(Id);
model.addAttribute("data", findByUserVideos);

百里香代码:

<video th:each="file : ${data}" width="100%" controls                                           poster="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg">
<source th:src="${file.preview}" type="video/mp4">                                              
    </video>

错误:

不允许加载本地资源:file:///H:/testing/1.mp4

标签: javaspringspring-boot

解决方案


推荐阅读