Developer Guide Javascript API Reference Developer Tools Release Notes

Linking to a Time Offset

In this demo the video starts from the beginning by default. However, if there is a time offset hash in the URL, the video will start from that time.

github

Click the button to reload the page with a time offset of 15 seconds. The appends #t=30 to the URL.

const hash = window.location.hash;
let offset = hash ? Number(window.location.hash.substr(3)) : false;
let shouldPlay = !!hash;

const playerInstance = jwplayer('player').setup({
  playlist: 'https://cdn.jwplayer.com/v2/media/1b02B03R',
  autostart: shouldPlay
});

playerInstance.on('firstFrame', () => {
  if (offset) {
    playerInstance.seek(offset);
  }
  offset = false;
});

document.getElementById('set-offset').addEventListener('click', () => {
  window.location.hash = '#t=15';
  window.location.reload();
});
This player implementation is a Proof of Concept only provided to show the possibilities of the JW Player and Platform and should not be taken as an offer to create, edit or maintain custom integration or development.