JWPlayer with Peer2 for HLS integration
JWPlayer is a feature rich video player that supports HLS. The integration with Peer2 plugin is easy and involves just two lines of code. In addition to the player script, simply include the Peer2 client and the matching Peer2 JWPlayer plugin based on your player version.
Peer2 client and plugins scripts
Add the following two scripts to the head of your player's page, based on your player version:
JWPlayer v8.x
<!-- Peer2 plugin for JWPlayer 8 -->
<script src="https://cdn.peer2.network/peer2.jwplayer8.plugins.js"></script>
Complete Example (JWPlayer v8.x)
The following information needs to be filled according to your actual data:
JWPLAYER_KEY your JWPlayer API key MANIFEST_FILE url to your .m3u8 file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JWPlayer Integration </title>
<!-- Peer2 plugin for JWPlayer 8 -->
<script src="https://cdn.peer2.network/peer2.jwplayer8.plugin.js"></script>
<!-- Player scripts -->
<script src="//cdn.peer2.network/jwplayer-8.20.4/jwplayer.js" type="text/javascript"></script>
<!-- JWPlayer license key -->
<script>jwplayer.key = 'JWPLAYER_KEY';</script>
</head>
<body>
<div id="player"></div>
<script>
var player = jwplayer("player");
player.setup({
file: "MANIFEST_FILE",
autostart: true,
mute: true, //optional, but recommended
});
let mypeer = new PEER2(player);
</script>
</body>
</html>