load thumbnail

This commit is contained in:
2021-05-25 09:39:34 +02:00
parent 358693035b
commit d418b429aa
3 changed files with 51 additions and 27 deletions

View File

@ -1,14 +1,24 @@
(() => {
const findUpstream = () => {
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 upstream = findUpstream();
const upstream = findUpstreamVideo();
const xhr = new XMLHttpRequest();
xhr.open("HEAD", upstream, true);
xhr.send();
@ -37,6 +47,7 @@
options.plugins.chromecast = {};
options.plugins.chromecast.addButtonToControlBar = false;
const player = videojs(video, options);
player.poster(findUpstreamPoster());
const source = {};
source.type = ctype;
source.src = upstream;