Developer Guide Javascript API Reference Developer Tools Release Notes

Performance Tracking

This demo measures key QoE metrics using the JW Player JavaScript API, including setup time and time to first frame.

github


This demo outputs Player setup time on page load. Press play to see how long it takes to reach the first frame of video.

The JW Player JavaScript API can be used to integrate with third party QoE systems. See our JavaScript API Reference for all available QoE/QoS events.

const playerInstance = jwplayer('player');
const logger = new Logger('logger');

playerInstance.setup({
  playlist: 'https://cdn.jwplayer.com/v2/media/i3q4gcBi',
  displaytitle: false,
  preload: 'metadata'
});

playerInstance.on('ready', function() {
  console.log(this.qoe());
  const setupTime = JSON.stringify(this.qoe().setupTime);
  logger.log(`The player set up in ${setupTime}ms.`);
});

playerInstance.on('firstFrame', function() {
  const firstFrame = JSON.stringify(this.qoe().firstFrame);
  logger.log(`The player took ${firstFrame}ms to get to the first video frame.`);
});