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) {

View File

@@ -1,24 +1,30 @@
class View {
constructor() {
this.init();
constructor() {}
createVideoPlayerObject() {
this.videoPlayer = new VideoPlayer();
}
init() {
//this.colorTogglePlaySVG();
showAddVideo() {
let body = document.getElementsByTagName("body")[0];
let about = document.getElementById("about");
let form = document.getElementById("form");
let textInput = document.getElementById("textInput");
let textArea = document.getElementById("textArea");
this.videoPlayer = new VideoPlayer();
about.classList.remove("hidden");
form.classList.remove("hidden");
textInput.classList.remove("hidden");
body.style.gridTemplateRows = "20vh auto";
/* Obarvení aktivního komentáře - dát do special metody */
/* var mySVG = document.getElementsByClassName("activeIcon")[0];
var svgDoc;
mySVG.addEventListener(
"load",
function () {
svgDoc = mySVG.contentDocument;
svgDoc.getElementById("path4").style.fill = "#ffa800";
},
false
); */
var Connect = new XMLHttpRequest();
// Define which file to open and
// send the request.
Connect.open("GET", "./videos/example.xml", false);
Connect.setRequestHeader("Content-Type", "text/xml");
Connect.send(null);
// Place the response in an XML document.
textArea.value = Connect.responseText;
}
drawCommentTitles(comments) {