将保管箱视频添加到html网页

时间:2019-03-18 16:19:12

标签: java html spring thymeleaf dropbox-api

我正在尝试使用thymeleaf将Dropbox Api(Java)中的视频文件(mp4)集成到我的春季网站上。但是,我无法访问视频文件的链接。 我的想法是->

<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>

谢谢!

1 个答案:

答案 0 :(得分:0)

I found it. I have to embed the shared file link and replace dl=0 with raw=1.

<html>
<main>
    <h2 th:text="${videoName}"></h2>
    <iframe th:src="${dropboxUrl}"></iframe>
    <p th:text="${videoDescription}"></p>
    ...
</main>
</html>

The original shared link can be received via ListSharedLinkResult.

ListSharedLinksResult listSharedLinksResult = dbxClientV2.sharing().listSharedLinksBuilder().withPath(dropboxPath).withDirectOnly(true).start();
String result = listSharedLinksResult.getLinks().get(0).getUrl();