【问题标题】:Add dropbox video to html web page将 Dropbox 视频添加到 html 网页
【发布时间】:2019-04-08 21:38:08
【问题描述】:
我正在尝试使用 thymeleaf 将来自 Dropbox Api (Java) 的视频文件 (mp4) 集成到我的 spring-made 网站。但是,我无法访问视频文件的链接。
我的想法是-->
<html>
<main>
<h2 th:text="${videoName}"></h2>
<video>
<source src="*/some url from the dropbox api to visualize the video\*"/>
</video>
<p th:text="${videoDescription}"></p>
...
</main>
</html>
谢谢!
【问题讨论】:
标签:
java
html
spring
thymeleaf
dropbox-api
【解决方案1】:
我找到了。我必须嵌入共享文件链接并将 dl=0 替换为 raw=1。
<html>
<main>
<h2 th:text="${videoName}"></h2>
<iframe th:src="${dropboxUrl}"></iframe>
<p th:text="${videoDescription}"></p>
...
</main>
</html>
可以通过 ListSharedLinkResult 接收原始共享链接。
ListSharedLinksResult listSharedLinksResult = dbxClientV2.sharing().listSharedLinksBuilder().withPath(dropboxPath).withDirectOnly(true).start();
String result = listSharedLinksResult.getLinks().get(0).getUrl();