Need help with openplayerjs?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

openplayerjs
376 Stars 46 Forks MIT License 1.3K Commits 6 Opened issues

Description

Lightweight HTML5 video/audio player with smooth controls and ability to play VAST/VPAID/VMAP ads

Services available

!
?

Need anything else?

Contributors list

OpenPlayer.js

openplayerjs

NPM

Tweet Coverage Status JSDelivr CircleCI

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 🚨

Version 3.0 of this player just started to being worked on.

As part of a continuous effort to improve the player, this new version will include, among others:

  • An increased unit test coverage (aiming to have at least
    70%
    ), including unit tests for all the demos.
  • Refactor of areas of code where creation of buttons for controls occurs, into a consolidated method to generate them.
  • Refactor of the main operations (
    load
    ,
    loadAd
    ,
    play
    ,
    pause
    ) to use Promises in a more clear fashion, and with that, execute more complex operations consistently, specially when dealing with loading dynamic content.
  • Better snippets/documentation to help users to configure OpenPlayerJS for their needs.
  • And more...

Because of the refactor that will be performed in that version, support for IE11 will be dropped completely. Also, to support the effort of ending the IE11 life cycle, scheduled on June 15, 2022.

So, please consider this before upgrading to any of the 3.x.x version going forward.

Advantages

  • Supports IE11+ (Win8) and 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.
  • Supports for local and remote captions for both video and audio, even without including the
    crossorigin
    attribute.
  • 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
    and
    fit
    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.

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/openplayer.min.css">


    <video class="op-player__media" id="player" controls playsinline>
        <source src="/path/to/video.mp4" type="video/mp4"></source>
        <track kind="subtitles" src="/path/to/video.vtt" srclang="en" label="English"></track>
    </video>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/openplayer.min.js"></script>
    <script>
        // Check the `API and events` link below for more options
        const player = new OpenPlayerJS('player');
        player.init();
    </script>

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

Intermediate

Advanced

Built With

Authors

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.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.