add poster image header
This commit is contained in:
@ -2,26 +2,11 @@
|
||||
const findUpstreamVideo = () => {
|
||||
const search = new URLSearchParams(location.search);
|
||||
search.set("render", "false");
|
||||
search.set("poster", "false");
|
||||
const url = new URL(location.origin);
|
||||
url.pathname = location.pathname;
|
||||
url.search = search.toString();
|
||||
return url.href;
|
||||
}
|
||||
const findUpstreamPoster = () => {
|
||||
const search = new URLSearchParams(location.search);
|
||||
search.set("render", "false");
|
||||
search.set("poster", "true");
|
||||
const url = new URL(location.origin);
|
||||
url.pathname = location.pathname;
|
||||
url.search = search.toString();
|
||||
return url.href;
|
||||
}
|
||||
|
||||
const getProvider = () => {
|
||||
const search = new URLSearchParams(location.search);
|
||||
return search.get("provider");
|
||||
}
|
||||
|
||||
const upstream = findUpstreamVideo();
|
||||
const xhr = new XMLHttpRequest();
|
||||
@ -41,6 +26,7 @@
|
||||
video.className = "video-js vjs-big-play-centered";
|
||||
body.appendChild(video);
|
||||
const ctype = xhr.getResponseHeader("Content-Type");
|
||||
const image = xhr.getResponseHeader("Custom-Poster");
|
||||
console.log(ctype);
|
||||
const options = {};
|
||||
options.controls = true;
|
||||
@ -52,8 +38,8 @@
|
||||
options.plugins.chromecast = {};
|
||||
options.plugins.chromecast.addButtonToControlBar = false;
|
||||
const player = videojs(video, options);
|
||||
if(getProvider() !== "nextcloud") {
|
||||
player.poster(findUpstreamPoster());
|
||||
if((image instanceof String) || ((typeof image) == "string")) {
|
||||
player.poster(image);
|
||||
}
|
||||
const source = {};
|
||||
source.type = ctype;
|
||||
|
Reference in New Issue
Block a user