Browse Source

Manually bust m3u8 caches (#570)

Fixes #567
pull/581/head
Matt Steele 4 years ago committed by GitHub
parent
commit
67c3f8ee38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      webroot/js/components/player.js

12
webroot/js/components/player.js

@ -57,14 +57,16 @@ class OwncastPlayer { @@ -57,14 +57,16 @@ class OwncastPlayer {
}
init() {
this.vjsPlayer = videojs(VIDEO_ID, VIDEO_OPTIONS);
this.vjsPlayer.beforeRequest = function (options) {
const cachebuster = Math.round(new Date().getTime() / 1000);
options.uri = `${options.uri}?cachebust=${cachebuster}`;
videojs.Vhs.xhr.beforeRequest = options => {
if (options.uri.match('m3u8')) {
const cachebuster = Math.round(new Date().getTime() / 1000);
options.uri = `${options.uri}?cachebust=${cachebuster}`;
}
return options;
};
this.vjsPlayer = videojs(VIDEO_ID, VIDEO_OPTIONS);
this.addAirplay();
this.vjsPlayer.ready(this.handleReady);
}

Loading…
Cancel
Save