Přidán formulář k přídávání videí

This commit is contained in:
2021-01-31 18:03:48 +01:00
parent a0406b44da
commit a9ac73a8e8
5 changed files with 151 additions and 34 deletions

View File

@@ -9,18 +9,22 @@ class Controller {
let videoToLoad = urlParams.get("v");
let video = document.getElementById("video");
this.loadVideo(videoToLoad).then(
function () {
video.addEventListener(
"loadedmetadata",
function () {
this.view.videoPlayer.updateVideoDuration();
this.addEventListenersToVideoControls();
this.init(videoToLoad);
}.bind(this)
);
}.bind(this)
);
if (videoToLoad != null && videoToLoad != "") {
this.loadVideo(videoToLoad).then(
function () {
video.addEventListener(
"loadedmetadata",
function () {
this.view.videoPlayer.updateVideoDuration();
this.addEventListenersToVideoControls();
this.init(videoToLoad);
}.bind(this)
);
}.bind(this)
);
} else {
this.view.showAddVideo();
}
}
init(videoToLoad) {
@@ -105,9 +109,15 @@ class Controller {
async loadVideo(v) {
let video = document.getElementById("video");
let source = document.createElement("source");
video.classList.remove("hidden");
source.setAttribute("src", "./videos/" + v + ".webm");
video.append(source);
video.children[0].src = "./videos/" + v + ".webm";
await video.load();
this.view.createVideoPlayerObject();
}
async loadXml(v) {