|
|
@ -12,7 +12,8 @@ class Controller {
|
|
|
|
if (videoToLoad != null && videoToLoad != "") {
|
|
|
|
if (videoToLoad != null && videoToLoad != "") {
|
|
|
|
this.model.loadXml(videoToLoad).then(
|
|
|
|
this.model.loadXml(videoToLoad).then(
|
|
|
|
function (v) {
|
|
|
|
function (v) {
|
|
|
|
let comments = this.model.parseXML(v);
|
|
|
|
this.model.parseXML(v);
|
|
|
|
|
|
|
|
let comments = this.model.comments;
|
|
|
|
let videoFileName = this.model.getVideoFileName(v);
|
|
|
|
let videoFileName = this.model.getVideoFileName(v);
|
|
|
|
this.view.drawCommentTitles(comments);
|
|
|
|
this.view.drawCommentTitles(comments);
|
|
|
|
this.addEventListeners();
|
|
|
|
this.addEventListeners();
|
|
|
@ -66,6 +67,7 @@ class Controller {
|
|
|
|
function () {
|
|
|
|
function () {
|
|
|
|
this.view.videoPlayer.updateProgress();
|
|
|
|
this.view.videoPlayer.updateProgress();
|
|
|
|
this.getActiveComment();
|
|
|
|
this.getActiveComment();
|
|
|
|
|
|
|
|
this.getActivePopup();
|
|
|
|
}.bind(this)
|
|
|
|
}.bind(this)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
video.addEventListener(
|
|
|
|
video.addEventListener(
|
|
|
@ -152,7 +154,6 @@ class Controller {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.activeComment !== null) {
|
|
|
|
if (this.activeComment !== null) {
|
|
|
|
this.view.activateComment(this.activeComment);
|
|
|
|
this.view.activateComment(this.activeComment);
|
|
|
|
console.log(this.model.comments[this.activeComment].text.length);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (
|
|
|
|
for (
|
|
|
|
let i = 0;
|
|
|
|
let i = 0;
|
|
|
@ -167,4 +168,31 @@ class Controller {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.lastActiveComment = this.activeComment;
|
|
|
|
this.lastActiveComment = this.activeComment;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getActivePopup() {
|
|
|
|
|
|
|
|
const video = document.getElementById("video");
|
|
|
|
|
|
|
|
let currentTime = video.currentTime;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < this.model.popups.length; i++) {
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
currentTime >= this.model.popups[i].start &&
|
|
|
|
|
|
|
|
currentTime <= this.model.popups[i].end
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
this.activePopup = i;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == this.model.popups.length - 1) {
|
|
|
|
|
|
|
|
this.activePopup = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.activePopup !== this.lastActivePopup) {
|
|
|
|
|
|
|
|
if (this.activePopup !== null) {
|
|
|
|
|
|
|
|
this.view.activatePopup(this.model.popups[this.activePopup].text);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.view.activatePopup(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.lastActivePopup = this.activePopup;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|