Manually bust m3u8 caches (#570)

Fixes #567
This commit is contained in:
Matt Steele
2021-01-02 13:30:29 -06:00
committed by GitHub
parent bda430f791
commit 67c3f8ee38

View File

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