Custom Player Integration

İlker Göktuğ edited this page Apr 26, 2016 · 1 revision


Gust object has a method called Request which comforts XMLHTTPRequest interface as a replacement to it. All you need to do is using Request instead XMLHTTPRequest on your data fetching requests. After this quick change on your video player everything will be same as before but you'll be using PeerGust infrastructure.


This our videojs-contrib-hls support plugin for Gust. You can see that how simple is integration. videojs.Hls.xhr.beforeRequest called before each xhr request by videojs-contrib-hls. The function receives options as a paramater which hosts an xhr prop. We simply initialize a new Request here and assign to xhr then return options. videojs-contrib-hls will use Request instead XMLHTTPRequest from now on.

  • See here for more information about beforeRequest.
  • videojs-contrib-hls uses Raynos/xhr as it's xhr module. See details of it's xhr option.
import {Request} from 'gust';
import videojs from 'video.js';

videojs.Hls.xhr.beforeRequest = function(options) {
  options.xhr = new Request;
  return options;