如何在 Github 页面 html 上加载视频?

我正在尝试使用 Github 页面在网页上播放一些视频,我已将视频文件上传到我的存储库,但是当我打开网页时视频没有加载,但在我运行时它们可以工作我的 .html 文件在本地。这是我所拥有的代码片段:

<video width="1280" height="720" controls autoplay muted loop>
<source src="videos/WebIntroG.mp4" type="video/mp4">
 Your browser does not support the video tag.
</video>

我也试过这个:

<video width="1280" height="720" controls autoplay muted loop>
<source src="https://michael1410.github.io/RobotGoon/videos/WebIntroG.mp4" type="video/mp4">
 Your browser does not support the video tag.
</video>

不确定这是否重要,但我的视频文件是用 git-lfs 存储的,它们超过 50MB。谢谢。

编辑:所以我上传了一个小于 25 MB 的较小的视频文件,并且成功了。所以 我不确定 gitpages 会加载大于 50MB 的 .mp4 文件 使用 git-lfs。

xdwm168 回答:如何在 Github 页面 html 上加载视频?

好的,所以解决方案由 VonC 发布在 MP4 file stored with git lfs not playing in Github Pages。对于使用 git-lfs 存储的 .mp4 文件,请使用:

https://media.githubusercontent.com/media/_Username_/_Project_/_Branch_/_Path_to_file_

编辑:请注意,git-lfs 有存储和带宽限制 每月 1GB,购买更多需要 5 美元(5 美元即可获得 50 GB)。

,

与“自动播放”、“静音”和“循环”一起尝试添加“playsinline”。它对我有用。

本文链接:https://www.f2er.com/910.html

大家都在问