openplayerjs

HTML5 video and audio player
- Static
- Latest Patch
- Latest Minor
- Latest Major
- 2.14.8
- 2.14.7
- 2.14.6
- 2.14.5
- 2.14.4
- 2.14.3
- 2.14.2
- 2.14.1
- 2.14.0
- 2.13.3
- 2.13.2
- 2.13.1
- 2.13.0
- 2.12.0
- 2.11.0
- 2.10.1
- 2.10.0
- 2.9.4
- 2.9.3
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.3
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.4
- 2.7.3
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.1
- 2.6.0
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.0
- 1.16.11
- 1.16.10
- 1.16.9
- 1.16.8
- 1.16.7
- 1.16.6
- 1.16.5
- 1.16.4
- 1.16.3
- 1.16.2
- 1.16.1
- 1.16.0
- 1.15.0
- 1.14.5
- 1.14.4
- 1.14.3
- 1.14.2
- 1.14.1
- 1.14.0
- 1.13.2
- 1.13.1
- 1.13.0
- 1.12.1
- 1.12.0
- 1.11.1
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.1
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.1
- 1.4.0
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
OpenPlayer.js
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.
🚨 IMPORTANT 🚨
🔧 This repository is in maintenance at this point. 🔧
No new features or additions will be added, only bug fixes.
Advantages
- Supports all modern browsers.
- No dependencies, since it is written in Typescript.
- Runs a simple but yet powerful algorithm to check the browser's autoplay capabilities across browsers.
- Enhance your player adding your own buttons. Check here for more details.
- Provides the ability to use a single VAST/VPAID source or a VAST/VPAID playlist from several different sources (including URLs and valid XML strings).
- Can play ads in infinite loop, desired for ads that are in a heavy text page.
- Always responsive by default, for both video/audio tags; for video,
fill
andfit
modes are available to either scale and crop media relative to its parent container, or to attempt to make the media fit its parent container (including black bars), respectively.
Migrating from older version to new ones
To learn more details about how to migrate from 1.x.x version to 2.x.x, or any breaking changes in newer versions, visit the Migration document.
Getting Started
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>
Usage and API Guides
If you want to unleash the power of OpenPlayerJS, learn more about OpenPlayerJS by checking the following links.
Code Samples
If you need a reference on how to use OpenPlayerJS in some of the most common scenarios, check the following links:
Beginners
- No configuration (only DOM classes)
- Minimal configuration
- Using
fill
mode - Using
fit
mode - Using Ads (linear and non-linear samples)
- Removing controls and using
preload="none"
- Using
Levels
and setting width/height - Use FLV source (only modern browsers and Android, not iOS)
- OpenPlayerJS with React
- OpenPlayerJS with Next.js
- OpenPlayerJS with Vue.js
- YouTube video (using plugin)
- Using hls.js p2p plugin
Intermediate
- Add source after initialization
- Playing HLS streaming with DRM (Encryption)
- M(PEG)-DASH with Ads
- Ads playlist (multiple URLs)
- Add a custom element (watermark)
Advanced
- Updating source and Ads for dynamic content loading
- Updating Ads and clickable Ad element
- Trigger Ad manually
- Fully customized audio player
- Basic playlist (video and audio)
- Retrieve data from audio streaming (HLS)
- Seamless transitions between media using custom control
Built With
- Typescript - The Javascript for Pros.
Authors
- Rafael Miranda - rafa8626
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.