Search code examples
htmlcssgithub-pages

MP4 file stored with git lfs not playing in Github Pages


I have an mp4 file I have in my repository stored with git lfs which I want to be able to play on my website. When I open the site with github pages, the video is not visible.

Any ideas what is happening?


Solution

  • Original answer (2019): You can see workarounds proposed in git-lfs/git-lfs issue 1342: "GitHub pages serving the reference file instead of the actual binary"

    The latest one (from Feb. 2019):

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

    You should replace all the _UNDERSCORED_ things to your's

    Example in this project: labcesi-strasbourg/labcesi-strasbourg.github.io commit 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
    });
    

    Update Oct. 2022: Marco suggests this might no longer work, and would use the following version:

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

    In other words:
    https://github.com/\<user>/<repository>/blob/<branch>/<path-to-file>?raw=true

    The above format works for every type of media (jpg, webm, etc..)