display comments from xml
This commit is contained in:
@@ -51,6 +51,7 @@ class Controller {
|
||||
"timeupdate",
|
||||
function () {
|
||||
this.view.videoPlayer.updateProgress();
|
||||
this.getActiveComment();
|
||||
}.bind(this)
|
||||
);
|
||||
video.addEventListener(
|
||||
@@ -85,4 +86,24 @@ class Controller {
|
||||
|
||||
return this.model.parseXML(TheDocument);
|
||||
}
|
||||
|
||||
getActiveComment() {
|
||||
const video = document.getElementById("video");
|
||||
let currentTime = Math.round(video.currentTime);
|
||||
|
||||
for (let i = 0; i < this.model.comments.length; i++) {
|
||||
if (
|
||||
currentTime > this.model.comments[i].start &&
|
||||
currentTime < this.model.comments[i].end
|
||||
) {
|
||||
console.log("active: " + i);
|
||||
this.view.activateComment(i);
|
||||
this.view.activateCommentText(this.model.comments[i].fulltext);
|
||||
return
|
||||
} else {
|
||||
this.view.activateComment(null);
|
||||
this.view.activateCommentText(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user