Top Related Projects
Video.js - open source HTML5 video player
:clapper: An extensible media player for the web.
The HTML5 video player for the web
HTML5 <audio> or <video> player with support for MP4, WebM, and MP3 as well as HLS, Dash, YouTube, Facebook, SoundCloud and others with a common HTML5 MediaElement API, enabling a consistent UI in all browsers.
HTML5 FLV Player
JavaScript player library / DASH & HLS client / MSE-EME player
Quick Overview
JW Player is an open-source video player for web and mobile platforms. It provides a customizable and feature-rich solution for embedding and streaming video content on websites and applications. JW Player supports various video formats and offers advanced features like adaptive streaming, advertising integration, and analytics.
Pros
- Highly customizable with a wide range of configuration options
- Supports multiple video formats and streaming protocols
- Robust API for programmatic control and integration
- Extensive documentation and community support
Cons
- Learning curve can be steep for advanced features
- Some premium features require a paid license
- Performance may be impacted with heavy customization
- Mobile support, while improved, can still have occasional issues
Code Examples
- Basic player setup:
jwplayer("myElement").setup({
file: "https://example.com/video.mp4",
width: "100%",
aspectratio: "16:9"
});
- Adding a playlist:
jwplayer("myElement").setup({
playlist: [{
file: "https://example.com/video1.mp4",
title: "First Video"
}, {
file: "https://example.com/video2.mp4",
title: "Second Video"
}]
});
- Implementing an event listener:
jwplayer("myElement").on('complete', function() {
console.log("Video playback completed");
});
Getting Started
To get started with JW Player:
- Include the JW Player JavaScript library in your HTML:
<script src="https://content.jwplatform.com/libraries/YOUR_PLAYER_KEY.js"></script>
- Create a container element for the player:
<div id="myElement"></div>
- Initialize the player with basic configuration:
jwplayer("myElement").setup({
file: "path/to/your/video.mp4",
width: "100%",
height: "100%"
});
This will create a basic video player with default controls. You can further customize the player by adding more configuration options or using the API to control playback programmatically.
Competitor Comparisons
Video.js - open source HTML5 video player
Pros of Video.js
- Open-source and free to use, with a large community of contributors
- Highly customizable with a wide range of plugins and skins
- Better documentation and more extensive API
Cons of Video.js
- Less robust DRM support compared to JW Player
- Fewer built-in analytics features
- May require more setup and configuration for advanced features
Code Comparison
Video.js:
videojs('my-video', {
controls: true,
autoplay: false,
preload: 'auto'
});
JW Player:
jwplayer("my-player").setup({
file: "video.mp4",
width: "100%",
aspectratio: "16:9"
});
Both players offer simple setup options, but JW Player's configuration tends to be more concise. Video.js provides more granular control over player settings out of the box, while JW Player often requires additional plugins or configuration for similar functionality.
Video.js is generally more flexible and customizable, making it a popular choice for developers who need fine-grained control over their video player. JW Player, on the other hand, offers a more polished out-of-the-box experience with better support for advanced features like DRM and analytics.
:clapper: An extensible media player for the web.
Pros of Clappr
- Open-source and free to use, allowing for greater customization and community contributions
- Lightweight and modular architecture, making it easier to extend and maintain
- Built-in support for adaptive streaming protocols like HLS and DASH
Cons of Clappr
- Smaller community and ecosystem compared to JWPlayer
- Less comprehensive documentation and fewer out-of-the-box features
- Limited commercial support options
Code Comparison
Clappr:
var player = new Clappr.Player({
source: "http://your.video/here.mp4",
parentId: "#player"
});
JWPlayer:
jwplayer("player").setup({
file: "http://your.video/here.mp4"
});
Both players offer simple setup processes, but JWPlayer's API is more concise. Clappr provides more explicit configuration options in its initialization, while JWPlayer relies on method chaining for additional settings.
Clappr's modular architecture allows for easy plugin development and integration, making it more flexible for developers who need to extend functionality. JWPlayer, on the other hand, offers a more comprehensive set of built-in features and a larger ecosystem of plugins, which can be beneficial for projects requiring extensive media player capabilities out of the box.
The HTML5 video player for the web
Pros of Flowplayer
- Open-source and free to use, allowing for greater customization and community contributions
- Lightweight and fast-loading, with a smaller file size compared to JW Player
- Simpler API and easier integration for basic video playback needs
Cons of Flowplayer
- Less extensive feature set and fewer advanced capabilities than JW Player
- Smaller ecosystem and fewer third-party integrations available
- Less frequent updates and potentially slower bug fixes compared to JW Player
Code Comparison
Flowplayer initialization:
flowplayer("#player", {
clip: {
sources: [
{ type: "video/mp4", src: "video.mp4" }
]
}
});
JW Player initialization:
jwplayer("player").setup({
file: "video.mp4",
width: "100%",
aspectratio: "16:9"
});
Both players offer straightforward initialization, but JW Player's setup tends to be more concise for basic configurations. Flowplayer's initialization allows for more granular control over clip sources, which can be beneficial in certain scenarios.
While both players serve similar purposes, JW Player generally offers more advanced features and a larger ecosystem, making it suitable for complex video implementations. Flowplayer, being open-source and lightweight, is a good choice for simpler projects or those requiring extensive customization.
HTML5 <audio> or <video> player with support for MP4, WebM, and MP3 as well as HLS, Dash, YouTube, Facebook, SoundCloud and others with a common HTML5 MediaElement API, enabling a consistent UI in all browsers.
Pros of MediaElement
- Open-source and free to use, with no licensing restrictions
- Lightweight and customizable, allowing for easier integration into various projects
- Supports a wide range of media formats and streaming protocols
Cons of MediaElement
- Less frequent updates and maintenance compared to JWPlayer
- Fewer advanced features and analytics capabilities out of the box
- May require more manual configuration for complex use cases
Code Comparison
MediaElement:
var player = new MediaElementPlayer('player1', {
features: ['playpause', 'current', 'progress', 'duration', 'volume'],
success: function(mediaElement, domObject) {
// Player is ready
}
});
JWPlayer:
jwplayer("myElement").setup({
file: "https://example.com/video.mp4",
width: "100%",
aspectratio: "16:9",
autostart: false
});
Both players offer straightforward setup, but JWPlayer's configuration tends to be more concise and feature-rich out of the box. MediaElement provides more granular control over player features, which can be beneficial for developers who need specific customizations.
While both players serve similar purposes, JWPlayer is generally considered more robust and feature-complete, especially for enterprise-level applications. However, MediaElement's open-source nature and flexibility make it an attractive option for developers who prioritize customization and have the resources to implement additional features as needed.
HTML5 FLV Player
Pros of flv.js
- Lightweight and focused specifically on FLV playback
- Open-source with an active community
- Designed for modern browsers with HTML5 support
Cons of flv.js
- Limited to FLV format, while JWPlayer supports multiple formats
- Fewer built-in features compared to JWPlayer's comprehensive solution
- May require more custom development for advanced functionality
Code Comparison
flv.js:
var flvPlayer = flvjs.createPlayer({
type: 'flv',
url: 'http://example.com/flv/video.flv'
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
JWPlayer:
jwplayer("myElement").setup({
file: "http://example.com/video.mp4",
width: "100%",
aspectratio: "16:9"
});
Summary
flv.js is a lightweight, open-source solution specifically for FLV playback in modern browsers. It's ideal for projects focused on FLV format and offers flexibility for custom implementations. However, it lacks the comprehensive features and multi-format support of JWPlayer.
JWPlayer, on the other hand, provides a more robust, all-in-one solution with support for various formats and built-in features. It's better suited for projects requiring a full-featured video player with minimal custom development, but comes with licensing costs and potential overhead for simpler use cases.
The choice between the two depends on specific project requirements, budget constraints, and desired level of customization.
JavaScript player library / DASH & HLS client / MSE-EME player
Pros of Shaka Player
- Open-source and free to use, with a permissive Apache 2.0 license
- Supports a wide range of streaming protocols, including DASH, HLS, and MSS
- Actively maintained with frequent updates and community contributions
Cons of Shaka Player
- Less extensive documentation compared to JW Player
- May require more technical expertise to implement and customize
- Fewer out-of-the-box features for monetization and analytics
Code Comparison
Shaka Player initialization:
var video = document.getElementById('video');
var player = new shaka.Player(video);
player.load('https://example.com/video.mpd');
JW Player initialization:
jwplayer("myElement").setup({
file: "https://example.com/video.mp4",
width: "100%",
aspectratio: "16:9"
});
Both players offer straightforward initialization, but JW Player provides more configuration options in its setup method. Shaka Player's approach is more focused on the core video playback functionality, while JW Player includes additional features like aspect ratio control out of the box.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Plays everywhere, every time.
Live on over 2 million sites with 1.3 billion unique plays per month, JW Player is the solution for seamless video playback across browsers and media types. It empowers the developer to interact with video programmatically to create unique and awesome user experiences.
Disclaimer
This is the non-commercial version of JW Player. It does not contain the same features as the commercial-use player available from jwplayer.com. Commercial use and access to features requires a license. Learn more at https://www.jwplayer.com/pricing/. If you are a paid customer and want a player, please download it from the "Downloads" section of your JW Dashboard.
Official Documentation
A Simple Example
The example below will render a video player into the div with the player
id, listens to an event, and makes a few calls using the API.
<!DOCTYPE html>
<html>
<head>
<script src='LINK_TO_YOUR_PLAYER'></script>
<script>jwplayer.key='YOUR_KEY';</script>
</head>
<body>
<div id="player">Loading the player...</div>
<script>
// Setup the player
const player = jwplayer('player').setup({
file: 'LINK_TO_YOUR_FILE.mp4'
});
// Listen to an event
player.on('pause', (event) => {
alert('Why did my user pause their video instead of watching it?');
});
// Call the API
const bumpIt = () => {
const vol = player.getVolume();
player.setVolume(vol + 10);
}
bumpIt();
</script>
</body>
</html>
Contributing
We appreciate all contributions towards the player! Before submitting an issue or PR, please see our contributing docs here.
Building the Player
We use grunt
and a few npm scripts
to build the player, lint code, and run tests. Debug code is built to /bin-debug
, while minified & uglified code is built to /bin-release
. Code is built with webpack
, linted with eslint
, and tested with karma
, mocha
and chai
.
Requirements:
- Node.js with npm
- Install global npm dependencies
npm install -g eslint grunt-cli jsdoc karma-cli stylelint webpack webpack-cli
Steps:
- Fork the project, clone your fork, and set up the remotes:
# Clone your fork of the repo into the current directory
git clone https://github.com/<your-username>/jwplayer
# Navigate to the newly cloned directory
cd jwplayer
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/jwplayer/jwplayer
- Install the dependencies:
# Install dependencies
npm install -g eslint grunt-cli jsdoc karma-cli stylelint webpack webpack-cli
npm install
# Optionally, install webpack-dev-server
npm install -g webpack-dev-server
- Build the player:
# Build once
grunt
# Complete Watch - builds JS, lints, and tests on each change
grunt serve
# Quick JS Watch - build only. Requires webpack-dev-server to be installed globally
webpack-dev-server -w --env.debug --port 8888 --output-public-path /bin-debug/
# Open the test page from another terminal window
open http://localhost:8888/test/manual/
- Test your code:
# All browsers
grunt test
# Individual browsers - chrome, firefox, safari
grunt karma:{BROWSER} e.g. grunt karma:chrome
- Lint your code:
npm run lint
- Setup git pre-push hook
This will add a
pre-push
script to the project's .git/hooks folder that will lint and run unit tests on the branch before any push.
grunt hooks
Framework Integration
The JW team officially maintains and supports framework integration for React.
Framework | Link |
---|---|
React | https://github.com/jwplayer/jwplayer-react |
If you have a library which you believe is good enough to meet the needs of other developers using a certain framework, please open a pull request modifying the above table.
Software License
The use of this library is governed by a Creative Commons license. You can use, modify, copy, and distribute this edition as long as itâs for non-commercial use, you provide attribution, and share under a similar license. http://www.jwplayer.com/license/
Top Related Projects
Video.js - open source HTML5 video player
:clapper: An extensible media player for the web.
The HTML5 video player for the web
HTML5 <audio> or <video> player with support for MP4, WebM, and MP3 as well as HLS, Dash, YouTube, Facebook, SoundCloud and others with a common HTML5 MediaElement API, enabling a consistent UI in all browsers.
HTML5 FLV Player
JavaScript player library / DASH & HLS client / MSE-EME player
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot