mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
Force videojs to set cache-control header and add a random query param to each request. Closes #82 I hope.
This commit is contained in:
parent
9cdd78ecbf
commit
515661804a
@ -17,7 +17,17 @@ class OwncastPlayer {
|
|||||||
this.handleEnded = this.handleEnded.bind(this);
|
this.handleEnded = this.handleEnded.bind(this);
|
||||||
this.handleError = this.handleError.bind(this);
|
this.handleError = this.handleError.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
videojs.Hls.xhr.beforeRequest = function (options) {
|
||||||
|
const cachebuster = Math.round(new Date().getTime() / 1000);
|
||||||
|
options.uri = options.uri + "?omgwtf=" + cachebuster;
|
||||||
|
options.headers = {
|
||||||
|
'Cache-Control':'no-cache'
|
||||||
|
};
|
||||||
|
return options;
|
||||||
|
};
|
||||||
|
|
||||||
this.vjsPlayer = videojs(VIDEO_ID, VIDEO_OPTIONS);
|
this.vjsPlayer = videojs(VIDEO_ID, VIDEO_OPTIONS);
|
||||||
this.addAirplay();
|
this.addAirplay();
|
||||||
this.vjsPlayer.ready(this.handleReady);
|
this.vjsPlayer.ready(this.handleReady);
|
||||||
@ -35,9 +45,7 @@ class OwncastPlayer {
|
|||||||
// play
|
// play
|
||||||
startPlayer() {
|
startPlayer() {
|
||||||
this.log('Start playing');
|
this.log('Start playing');
|
||||||
const cachebuster = Math.round(new Date().getTime() / 1000);
|
|
||||||
const source = { ...VIDEO_SRC }
|
const source = { ...VIDEO_SRC }
|
||||||
source.src = source.src + "?okhi=" + cachebuster
|
|
||||||
this.vjsPlayer.src(source);
|
this.vjsPlayer.src(source);
|
||||||
// this.vjsPlayer.play();
|
// this.vjsPlayer.play();
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user