Search code examples
plyrvideo.js

Integrating video lib without node.js or npm


I have an absolute beginner question: I am a hobby coder and coming from the time, when integrating a library in my own project was downloading xx.js and xx.css on GitHub, puting them in the header and everything worked fine.

Today I tried to integrate the libraries Plyr.js and Video.js to my project, but without a CDN. So I downloaded them on GitHub, but they don't contain compiled css.

How can I integrate them on a shared Webhosting without any Node.js, NPM etc.?

(Sorry for that maybe stupid question)


Solution

  • Dist versions of complex projects aren't typically checked into version control. You can use Video.js's CDN hosted dist versions as mentioned here.

    <link href="https://vjs.zencdn.net/7.18.1/video-js.css" rel="stylesheet" />
    <script src="https://vjs.zencdn.net/7.18.1/video.min.js"></script>
    

    For NPM packages generally, you can use a service like unpkg or jsdelivr to get CDN hosted versions of dist files, e.g.

    https://unpkg.com/browse/[email protected]/dist/video.min.js
    https://unpkg.com/browse/[email protected]/dist/video-js.css
    https://cdn.jsdelivr.net/npm/[email protected]/dist/video.min.js
    https://cdn.jsdelivr.net/npm/[email protected]/dist/video-js.css
    

    If you don't want to directly use the URLs, you can download the dist files from there.

    Alternatively you can look at the releases page on GitHub, where you'll find a zip archive of files, e.g. https://github.com/videojs/video.js/releases