
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
openplayerjs
Advanced tools
This is a media player that uses all the goods of HTML5 video/audio elements to play the most popular media in MP4/MP3, HLS and M(PEG)-DASH, and also has the ability to play VMAP, VAST and VPAID ads.
crossorigin
attribute.fill
mode is also included to scale and crop media relative to its parent container.In order to achieve a smooth upgrading between version 1.x.x
and 2.x.x
, there is a couple of things to keep in mind:
controls
and showLiveProgress
properties are now complex object structures, where we can indicate visibility and a new set of extra layers/visibility.To simplify this even more:
const player = new OpenPlayerJS('player', 'https://ads.example.url/xml', true, {
controls: {
left: ['play', 'time', 'volume'],
middle: ['progress'],
right: ['captions', 'settings', 'fullscreen'],
},
showLiveProgress: false,
// ...other player options
});
player.init();
const player = new OpenPlayerJS('player', {
ads: {
src: 'https://ads.example.url/xml', // equivalent to the second argument in v1.x.x
// ...other ads options
},
mode: 'fullscreen', // equivalent to `true` in third argument in v1.x.x
controls: {
alwaysVisible: false,
// Also available: `top-left`, `top-middle`,
// `top-right`, `bottom-left`, `bottom-middle` and `bottom-right` or `main`
layers: {
left: ['play', 'time', 'volume'],
middle: ['progress'],
right: ['captions', 'settings', 'fullscreen'],
}
},
live: {
showLabel: true,
showProgress: false, // equivalent of `showLiveProgress` in v1.x.x
},
// ...other player options
});
player.init();
The standard template to start using OpenPlayerJS is show in the following snippet.
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/openplayerjs@latest/dist/openplayer.min.css">
</head>
<body>
<video class="op-player__media" id="player" controls playsinline>
<source src="/path/to/video.mp4" type="video/mp4">
<track kind="subtitles" src="/path/to/video.vtt" srclang="en" label="English">
</video>
<script src="https://cdn.jsdelivr.net/npm/openplayerjs@latest/dist/openplayer.min.js"></script>
<script>
// Check the `API and events` link below for more options
const player = new OpenPlayerJS('player');
player.init();
</script>
</body>
</html>
If you want to unleash the power of OpenPlayerJS, learn more about OpenPlayerJS by checking the following links.
In 2.x.x, the demo
folder is now removed in favor of code samples.
If you need a reference on how to use OpenPlayerJS in some of the most common scenarios, check the following links:
fill
modefit
modepreload="none"
Levels
and setting width/heightSee also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details.
FAQs
HTML5 video and audio player
The npm package openplayerjs receives a total of 1,883 weekly downloads. As such, openplayerjs popularity was classified as popular.
We found that openplayerjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.