【问题标题】:How to Get Videos to Load on Github Pages html?如何让视频加载到 Github Pages html 上?
【发布时间】:2021-10-07 07:50:18
【问题描述】:

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

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

【问题讨论】:

  • css和js文件等其余文件是否正常工作?
  • 是的,其他一切正常
  • 你能检查你上传的视频吗?因为您提供的网址不起作用。 michael1410.github.io/RobotGoon/videos/WebIntroG.mp4
  • 是的,链接不起作用,但我可以从我的 repo 下载视频文件,它们可以工作,所以文件就在那里。

标签: html github github-pages


【解决方案1】:

好的,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)。

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-21
      • 1970-01-01
      • 2021-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-22
      相关资源
      最近更新 更多