使用 git lfs 存储的 MP4 文件无法在 Github Pages 中播放

Ros*_*kar 6 html css github-pages

我的存储库中有一个 mp4 文件,用 git lfs 存储,我希望能够在我的网站上播放。当我打开带有 github 页面的网站时,视频不可见。

有什么想法吗?

Von*_*onC 6

原始答案(2019):您可以看到git-lfs/git-lfs 问题 1342中提出的解决方法:“GitHub 页面提供参考文件而不是实际的二进制文件”

最新一期(2019 年 2 月起):

https://media.githubusercontent.com/media/_Username_/_Project_/_Branch_/_Path_to_file_
Run Code Online (Sandbox Code Playgroud)

你应该把所有的_UNDERSCORED_东西都换成你的

本项目中的示例:labcesi-strasbourg/labcesi-strasbourg.github.iocommit c53bd39

vrView.setContent({
    //image: 'V0050069.jpg',
    image: 'https://media.githubusercontent.com/media/labcesi-strasbourg/labcesi-strasbourg.github.io/master/V0050069.jpg',
    //preview:'/url/to/amazing-512.jpg',
    is_stereo: false
});
Run Code Online (Sandbox Code Playgroud)

2022 年 10 月更新:Marco建议这可能不再有效,并将使用以下版本:

https://github.com/labcesi-strasbourg/labcesi-strasbourg.github.io/blob/master/V0050069.jpg?raw=true

换句话说:
https://github.com/\ <user>/<repository>/blob/<branch>/<path-to-file>?raw=true

上述格式适用于各种类型的媒体(jpg、webm 等)