Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Manually bust m3u8 caches (#570)

Matt Steele7b8e52a3b1e3
diff --git a/webroot/js/components/player.js b/webroot/js/components/player.js
index a2d738d7bf..bcab2fa4a2 100644
--- a/webroot/js/components/player.js
+++ b/webroot/js/components/player.js
@@ -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);
}