Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including videojs-fairplay with all npm packages installed. Try it out:

var videojsFairplay = require("videojs-fairplay")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

videojs-fairplay v0.2.0

Video.js tech for supporting Fairplay streaming.


Video.js source handler for supporting Fairplay streaming.

Protected Content

This source handler only supports encrypted HLS playback. It does not contain any fallbacks. The premise is to use this in tandem with videojs-contrib-dash to support encrypted playback in all* browsers.

If the browser (a.k.a Safari) supports Encrypted Media Extensions and includes a Content Decryption Module, video.js will be able to playback protected content.

Getting Started

<script src="/path/to/videojs.fairplay.min.js"></script>

videojs('player_id').ready(function () {
    src: '/path/to/file.m3u8',
    type: 'application/x-mpegURL',

    protection: {
      keySystem: '',

      certificateUrl: '/path/to/certificate',
      licenseUrl: '/path/to/license',

Known Issues


  1. Fairplay content cannot be played if TextTracks exist. Beyond embedding them within the manifest, the only way to side load them is after the keys are updated.
videojs('player_id').ready(function () {
  var player = this;

  player.on('loadeddata', function () {
  1. New Fairplay content cannot be played once MediaKeys have been attached to the video element (Unless its the same source). To get around this issue we need to clear those keys.

  1. Combining the issues of #1 and #2. Before you can play another source, you must clear out the existing TextTracks.
player.remoteTextTracks().tracks_.forEach(function (track) {

// the current `TextTrack` implementation operates on events and because of this we have to wait a
// tick before executing a reset, otherwise the `TextTrack`s will get picked up in its associated `Tech`.
setTimeout(function () {

}, 0);

Contributing + Example

npm install -g grunt-cli # only needed for contributing

npm install

npm start


Code licensed under The MIT License.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free