|
|
@ -10,14 +10,22 @@ class Controller {
|
|
|
|
let video = document.getElementById("video");
|
|
|
|
let video = document.getElementById("video");
|
|
|
|
|
|
|
|
|
|
|
|
if (videoToLoad != null && videoToLoad != "") {
|
|
|
|
if (videoToLoad != null && videoToLoad != "") {
|
|
|
|
this.loadVideo(videoToLoad).then(
|
|
|
|
this.model.loadXml(videoToLoad).then(
|
|
|
|
|
|
|
|
function (v) {
|
|
|
|
|
|
|
|
let comments = this.model.parseXML(v);
|
|
|
|
|
|
|
|
let videoFileName = this.model.getVideoFileName(v);
|
|
|
|
|
|
|
|
this.view.drawCommentTitles(comments);
|
|
|
|
|
|
|
|
this.addEventListeners();
|
|
|
|
|
|
|
|
this.loadVideo(videoFileName).then(
|
|
|
|
function () {
|
|
|
|
function () {
|
|
|
|
video.addEventListener(
|
|
|
|
video.addEventListener(
|
|
|
|
"loadedmetadata",
|
|
|
|
"loadedmetadata",
|
|
|
|
function () {
|
|
|
|
function () {
|
|
|
|
this.view.videoPlayer.updateVideoDuration();
|
|
|
|
this.view.videoPlayer.updateVideoDuration();
|
|
|
|
|
|
|
|
this.view.drawCommentsToVideo(comments);
|
|
|
|
this.addEventListenersToVideoControls();
|
|
|
|
this.addEventListenersToVideoControls();
|
|
|
|
this.init(videoToLoad);
|
|
|
|
}.bind(this)
|
|
|
|
|
|
|
|
);
|
|
|
|
}.bind(this)
|
|
|
|
}.bind(this)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}.bind(this)
|
|
|
|
}.bind(this)
|
|
|
@ -28,21 +36,14 @@ class Controller {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
init(videoToLoad) {
|
|
|
|
|
|
|
|
this.loadXml(videoToLoad).then(
|
|
|
|
|
|
|
|
function (v) {
|
|
|
|
|
|
|
|
this.view.drawCommentTitles(v);
|
|
|
|
|
|
|
|
this.addEventListeners();
|
|
|
|
|
|
|
|
this.view.drawCommentsToVideo(v);
|
|
|
|
|
|
|
|
}.bind(this)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addEventListenersToAddVideo() {
|
|
|
|
addEventListenersToAddVideo() {
|
|
|
|
let form = document.getElementById("form");
|
|
|
|
let form = document.getElementById("form");
|
|
|
|
form.addEventListener("submit", function () {
|
|
|
|
form.addEventListener(
|
|
|
|
|
|
|
|
"submit",
|
|
|
|
|
|
|
|
function () {
|
|
|
|
document.getElementById("xmlFile").value = this.view.editor.getValue();
|
|
|
|
document.getElementById("xmlFile").value = this.view.editor.getValue();
|
|
|
|
}.bind(this));
|
|
|
|
}.bind(this)
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Přidání listenerů
|
|
|
|
// Přidání listenerů
|
|
|
@ -121,28 +122,13 @@ class Controller {
|
|
|
|
|
|
|
|
|
|
|
|
video.classList.remove("hidden");
|
|
|
|
video.classList.remove("hidden");
|
|
|
|
|
|
|
|
|
|
|
|
source.setAttribute("src", "./videos/" + v + ".webm");
|
|
|
|
source.setAttribute("src", "./videos/" + v);
|
|
|
|
video.append(source);
|
|
|
|
video.append(source);
|
|
|
|
|
|
|
|
|
|
|
|
await video.load();
|
|
|
|
await video.load();
|
|
|
|
this.view.createVideoPlayerObject();
|
|
|
|
this.view.createVideoPlayerObject();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async loadXml(v) {
|
|
|
|
|
|
|
|
var Connect = new XMLHttpRequest();
|
|
|
|
|
|
|
|
// Define which file to open and
|
|
|
|
|
|
|
|
// send the request.
|
|
|
|
|
|
|
|
Connect.open("GET", "./videos/" + v + ".xml", false);
|
|
|
|
|
|
|
|
Connect.setRequestHeader("Content-Type", "text/xml");
|
|
|
|
|
|
|
|
Connect.send(null);
|
|
|
|
|
|
|
|
// Place the response in an XML document.
|
|
|
|
|
|
|
|
var TheDocument = Connect.responseText;
|
|
|
|
|
|
|
|
// Place the root node in an element.
|
|
|
|
|
|
|
|
// var Customers = TheDocument.childNodes[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return this.model.parseXML(TheDocument);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getActiveComment() {
|
|
|
|
getActiveComment() {
|
|
|
|
const video = document.getElementById("video");
|
|
|
|
const video = document.getElementById("video");
|
|
|
|
let currentTime = video.currentTime;
|
|
|
|
let currentTime = video.currentTime;
|
|
|
|