A small library to play multimedia (video/audio) on scroll.
Checkout the demo here
For this library get to work, you'll have to follow some steps.
You can download it directly from GitHub
<script src="/path/to/DynamicPlayer.js"></script>
<body>
...
<video id="my-video" controls>
<source src="./my/video/path.mp4" />
</video>
...
</body>
const multimediaOptions = {
selector: '#my-video',
playOnCoords: { x: 0, y: 1230 }
// Video will play when the user scrolls vertically 1230 pixels
};
const myVideo = new DynamicPlayer(multimediaOptions);
myVideo.init();
Dynamic Player works in all moderns browsers. It's built using ES6 classes, so it doesn't work on IE (yet).
- Add demo
- Minified version
- Internet Explorer support
- Send an array of multimedia objects as contructor
- CDN link
- NPM package
The code is available under MIT License.