Skip to content
Snippets Groups Projects
Commit 8cdb6595 authored by Sebastien's avatar Sebastien
Browse files

Fix bug on image thumbnail

parent 1985cea9
No related branches found
No related tags found
1 merge request!98refresh the mosaic on annotation modification
Pipeline #1086 passed
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
function Project(url) { function Project(url, rekall) {
this.sources = new Object(); this.sources = {};
this.url = url; this.url = url;
this.firstAnalysis = true; this.firstAnalysis = true;
this.metadata = { this.metadata = {
...@@ -34,9 +34,11 @@ function Project(url) { ...@@ -34,9 +34,11 @@ function Project(url) {
"Comments": "", "Comments": "",
}; };
var urlItems = rekall.baseUrl.split("/"); var urlItems = rekall.baseUrl.split("/");
urlItems = $.grep(urlItems,function(n){ return(n) }); urlItems = $.grep(urlItems, function (n) {
return (n)
});
this.metadata["Title"] = urlItems[urlItems.length - 1]; this.metadata["Title"] = urlItems[urlItems.length - 1];
this.rekall = rekall;
} }
Project.prototype.addDocument = function (key, document) { Project.prototype.addDocument = function (key, document) {
...@@ -44,6 +46,7 @@ Project.prototype.addDocument = function(key, document) { ...@@ -44,6 +46,7 @@ Project.prototype.addDocument = function(key, document) {
this.sources[key] = new Source(); this.sources[key] = new Source();
this.sources[key].addDocument(document); this.sources[key].addDocument(document);
} }
Project.prototype.getDocument = function (path) { Project.prototype.getDocument = function (path) {
var retour = undefined; var retour = undefined;
for (var key in this.sources) { for (var key in this.sources) {
...@@ -56,23 +59,22 @@ Project.prototype.getDocument = function(path) { ...@@ -56,23 +59,22 @@ Project.prototype.getDocument = function(path) {
Project.prototype.loadXML = function (xml) { Project.prototype.loadXML = function (xml) {
this.sources["Files"] = new Source(); this.sources["Files"] = new Source();
var thiss = this; let thiss = this;
var counts = {documents: 0, tags: 0, metadatas: 0}; let counts = {documents: 0, tags: 0, metadatas: 0};
xml.find('document').each(function () { xml.find('document').each(function () {
if (($(this).attr("remove") != undefined) && ($(this).attr("key") != undefined) && ($(this).attr("remove") == "true")) { if (($(this).attr("remove") != undefined) && ($(this).attr("key") != undefined) && ($(this).attr("remove") == "true")) {
var rekallDoc = thiss.sources["Files"].documents[$(this).attr("key")]; var rekallDoc = thiss.sources["Files"].documents[$(this).attr("key")];
if (rekallDoc != undefined) { if (rekallDoc != undefined) {
for (var tagIndex in rekallDoc.tags) for (var tagIndex in rekallDoc.tags)
rekallDoc.tags[tagIndex].visuel.rect.remove(); rekallDoc.tags[tagIndex].visuel.rect.remove();
delete rekall.project.sources["Files"].documents[rekallDoc.key]; delete this.rekall.project.sources["Files"].documents[rekallDoc.key];
} }
} } else {
else { let rekallDoc = new Document();
var rekallDoc = new Document();
counts.documents++; counts.documents++;
counts.tags++; counts.tags++;
$(this).find('meta').each(function () { $(this).find('meta').each(function () {
var rekallDocMeta = new Metadata(); let rekallDocMeta = new Metadata();
rekallDocMeta.content = $(this).attr('cnt'); rekallDocMeta.content = $(this).attr('cnt');
rekallDocMeta.metadataKey = $(this).attr('ctg'); rekallDocMeta.metadataKey = $(this).attr('ctg');
rekallDoc.setMetadata(rekallDocMeta); rekallDoc.setMetadata(rekallDocMeta);
...@@ -84,7 +86,7 @@ Project.prototype.loadXML = function(xml) { ...@@ -84,7 +86,7 @@ Project.prototype.loadXML = function(xml) {
} }
}); });
xml.find('edition').each(function () { xml.find('edition').each(function () {
var key = $(this).attr('key'); let key = $(this).attr('key');
if (thiss.sources["Files"].documents[key] != undefined) { if (thiss.sources["Files"].documents[key] != undefined) {
var version = $(this).attr('version'); var version = $(this).attr('version');
var metadataKey = $(this).attr('metadataKey'); var metadataKey = $(this).attr('metadataKey');
...@@ -93,11 +95,11 @@ Project.prototype.loadXML = function(xml) { ...@@ -93,11 +95,11 @@ Project.prototype.loadXML = function(xml) {
} }
}); });
xml.find('tag').each(function () { xml.find('tag').each(function () {
var key = $(this).attr('key'); let key = $(this).attr('key');
if (thiss.sources["Files"].documents[key] != undefined) { if (thiss.sources["Files"].documents[key] != undefined) {
var version = $(this).attr('version'); let version = $(this).attr('version');
var timeStart = parseFloat($(this).attr('timeStart')) + 0.; let timeStart = parseFloat($(this).attr('timeStart')) + 0.;
var timeEnd = parseFloat($(this).attr('timeEnd')) + 0.; let timeEnd = parseFloat($(this).attr('timeEnd')) + 0.;
for (var index in thiss.sources["Files"].documents[key].tags) { for (var index in thiss.sources["Files"].documents[key].tags) {
thiss.sources["Files"].documents[key].tags[index].setTimeStart(timeStart); thiss.sources["Files"].documents[key].tags[index].setTimeStart(timeStart);
thiss.sources["Files"].documents[key].tags[index].setTimeEnd(timeEnd); thiss.sources["Files"].documents[key].tags[index].setTimeEnd(timeEnd);
...@@ -107,96 +109,17 @@ Project.prototype.loadXML = function(xml) { ...@@ -107,96 +109,17 @@ Project.prototype.loadXML = function(xml) {
xml.find('projectMeta').each(function () { xml.find('projectMeta').each(function () {
thiss.metadata[$(this).attr('ctg')] = $(this).attr('cnt'); thiss.metadata[$(this).attr('ctg')] = $(this).attr('cnt');
}); });
var videoUrl = undefined, videoTech = undefined; let videoUrl = undefined, videoTech = undefined;
xml.find('video').each(function () { xml.find('video').each(function () {
videoUrl = $(this).attr('url'); videoUrl = $(this).attr('url');
videoTech = $(this).attr('tech'); videoTech = $(this).attr('tech');
}); });
if((videoUrl != "") && (videoUrl != undefined)) { if (this.rekall.ensureVideoPlayerCreated(videoUrl, videoTech)) {
var techOrder = ["vimeo", "youtube", "html5"];
if(videoUrl.indexOf("youtube") >= 0) videoTech = "youtube";
if(videoUrl.indexOf("youtu.be") >= 0) videoTech = "youtube";
if(videoUrl.indexOf("vimeo") >= 0) videoTech = "vimeo";
if(videoUrl.indexOf("dailymotion") >= 0) videoTech = "dailymotion";
if(videoUrl.indexOf("dai.ly") >= 0) videoTech = "dailymotion";
if((videoTech != "") && (videoTech != undefined))
techOrder = [videoTech, "html5"];
//Video
if(rekall.videoPlayer == undefined) {
videojs("video", {
"techOrder": techOrder,
"controls": true,
"autoplay": false,
"loop": "false",
"preload": "auto",
"sources": [
{
"type": "video/" + videoTech,
"src": videoUrl
}
]
}, function() {
rekall.videoPlayer = this;
$(".vjs-fullscreen-control").hide();
rekall.videoPlayer.on("durationchange", function(e) {
rekall.videoPlayer.markers.removeAll == undefined;
if(counts.documents>0){
rekall.project.analyse();
rekall.videoPlayer.markers.initialize();
}
});
rekall.videoPlayer.on("ended", function(e) {
});
rekall.videoPlayer.on("error", function(e) {
});
rekall.videoPlayer.on("firstplay", function(e) {
});
rekall.videoPlayer.on("fullscreenchange", function(e) {
});
rekall.videoPlayer.on("loadedalldata", function(e) {
});
rekall.videoPlayer.on("loadeddata", function(e) {
});
rekall.videoPlayer.on("loadedmetadata", function(e) {
console.log(counts.documents + " documents analysés, " + counts.metadatas + " métadonnées extraites et " + counts.tags + " tags affichés !");
if(counts.documents>0){
rekall.project.analyse();
}
});
rekall.videoPlayer.on("loadstart", function(e) {
});
rekall.videoPlayer.on("pause", function(e) {
});
rekall.videoPlayer.on("play", function(e) {
});
rekall.videoPlayer.on("progress", function(e) {
});
rekall.videoPlayer.on("seeked", function(e) {
});
rekall.videoPlayer.on("seeking", function(e) {
});
rekall.videoPlayer.on("timeupdate", function(e) {
rekall.timeline.update(rekall.videoPlayer.currentTime());
});
rekall.videoPlayer.on("volumechange", function(e) {
});
rekall.videoPlayer.on("waiting", function(e) {
});
rekall.videoPlayer.on("resize", function(e) {
});
$(window).trigger("resize"); $(window).trigger("resize");
});
}
else {
console.log(counts.documents + " documents analysés, " + counts.metadatas + " métadonnées extraites et " + counts.tags + " tags affichés !");
rekall.project.analyse();
}
} }
this.analyse();
} }
Project.prototype.timelineUpdate = function () { Project.prototype.timelineUpdate = function () {
...@@ -206,37 +129,36 @@ Project.prototype.timelineUpdate = function() { ...@@ -206,37 +129,36 @@ Project.prototype.timelineUpdate = function() {
Project.prototype.analyse = function () { Project.prototype.analyse = function () {
$('#flattentimeline').html("<div id='flattentimeline_highlight'></div>"); $('#flattentimeline').html("<div id='flattentimeline_highlight'></div>");
var parsed_labels = $('input.annotation_labels').toArray().map(i => i.value); let parsed_labels = $('input.annotation_labels').toArray().map(i => i.value);
//Analyse //Analyse
Tags.flattenTimelineTags = []; Tags.reset();
var filtredTags = new Array(); this.rekall.sortings["horizontal"].analyseStart();
rekall.sortings["horizontal"].analyseStart(); this.rekall.sortings["colors"].analyseStart();
rekall.sortings["colors"] .analyseStart(); for (let keySource in this.sources) {
for (var keySource in this.sources) { for (let keyDocument in this.sources[keySource].documents) {
for (var keyDocument in this.sources[keySource].documents) { for (let key in this.sources[keySource].documents[keyDocument].tags) {
for (var key in this.sources[keySource].documents[keyDocument].tags) { let tag = this.sources[keySource].documents[keyDocument].tags[key];
var tag = this.sources[keySource].documents[keyDocument].tags[key]; this.rekall.sortings["horizontal"].analyseAdd(tag);
rekall.sortings["horizontal"].analyseAdd(tag); this.rekall.sortings["colors"].analyseAdd(tag);
rekall.sortings["colors"] .analyseAdd(tag); Tags.push(tag);
Tags.flattenTimelineTags.push(tag); let labels = tag.getMetadata('Rekall->Labels');
var labels = tag.getMetadata('Rekall->Labels');
if (labels && labels != '') { if (labels && labels != '') {
var input_template = $('input.annotation_labels_template').first(); let input_template = $('input.annotation_labels_template').first();
var html_label_template = $('label.annotation_labels_template').first(); let html_label_template = $('label.annotation_labels_template').first();
var _labels = labels.split(';'); let _labels = labels.split(';');
for (var i in _labels) { for (let i in _labels) {
var label = _labels[i]; let label = _labels[i];
if (label == '') continue; if (label == '') continue;
if (parsed_labels.indexOf(label) != -1) if (parsed_labels.indexOf(label) != -1)
continue; continue;
parsed_labels.push(label); parsed_labels.push(label);
var inp = input_template.clone(); let inp = input_template.clone();
var id = 'annotation_label_' + parsed_labels.indexOf(label); let id = 'annotation_label_' + parsed_labels.indexOf(label);
inp.attr('id', id); inp.attr('id', id);
inp.attr('value', label); inp.attr('value', label);
var html_label = html_label_template.clone(); let html_label = html_label_template.clone();
html_label.attr('for', id); html_label.attr('for', id);
html_label.html(label); html_label.html(label);
...@@ -251,24 +173,20 @@ Project.prototype.analyse = function() { ...@@ -251,24 +173,20 @@ Project.prototype.analyse = function() {
} }
} }
} }
rekall.sortings["horizontal"].analyseEnd(); this.rekall.sortings["horizontal"].analyseEnd();
rekall.sortings["colors"] .analyseEnd(); this.rekall.sortings["colors"].analyseEnd();
Tags.flattenTimelineTags.sort(function(a, b) { Tags.sort();
if(a.timeStart < b.timeStart) return -1;
if(a.timeStart > b.timeStart) return 1;
return 0;
});
//Affichage //Affichage
var categories = rekall.sortings["horizontal"].categories; let categories = rekall.sortings["horizontal"].categories;
if(rekall.sortings["horizontal"].metadataKey == "Time") if (this.rekall.sortings["horizontal"].metadataKey == "Time")
categories = {time: {tags: Tags.flattenTimelineTags}}; categories = {time: {tags: Tags.getFlattenTimeLineTags()}};
//Affectation des couleurs //Affectation des couleurs
for (var key in rekall.sortings["colors"].categories) { for (let key in this.rekall.sortings["colors"].categories) {
var colorSortingCategory = rekall.sortings["colors"].categories[key]; let colorSortingCategory = this.rekall.sortings["colors"].categories[key];
for (var key in colorSortingCategory.tags) { for (let tagKey in colorSortingCategory.tags) {
var tag = colorSortingCategory.tags[key]; let tag = colorSortingCategory.tags[tagKey];
tag.update(colorSortingCategory.color); tag.update(colorSortingCategory.color);
tag.isSelectable = colorSortingCategory.checked; tag.isSelectable = colorSortingCategory.checked;
} }
...@@ -276,8 +194,8 @@ Project.prototype.analyse = function() { ...@@ -276,8 +194,8 @@ Project.prototype.analyse = function() {
//Tags / catégories //Tags / catégories
var markers = [], captions = []; let markers = [], captions = [];
for (var key in categories) { for (let key in categories) {
$.each(categories[key].tags, function (index, tag) { $.each(categories[key].tags, function (index, tag) {
//Elements sur la timeline //Elements sur la timeline
markers.push({ markers.push({
...@@ -317,32 +235,28 @@ Project.prototype.analyse = function() { ...@@ -317,32 +235,28 @@ Project.prototype.analyse = function() {
} }
//Analyse de vignettes //Analyse de vignettes
if(true) { let thumbUrl = Utils.getPreviewPath(tag);
var thumbUrl = Utils.getPreviewPath(tag);
tag.thumbnail = {url: thumbUrl, tag: tag}; tag.thumbnail = {url: thumbUrl, tag: tag};
}
if ((tag.getMetadata("Rekall->Highlight") != undefined) && (tag.getMetadata("Rekall->Highlight") != "")) { if ((tag.getMetadata("Rekall->Highlight") != undefined) && (tag.getMetadata("Rekall->Highlight") != "")) {
//Dom //Dom
$('#flattentimeline').append(function () { $('#flattentimeline').append(function () {
var styleColor = "background-color: " + tag.color + ";"; let styleColor = "background-color: " + tag.color + ";";
var textColor = "color: " + tag.color + ";"; let textColor = "color: " + tag.color + ";";
var textColor2 = "color: rgba(255,255,255,1)";
var textColor3 = "color: rgba(255,255,255,.75)";
var colorTransp = ""; let colorTransp = "";
var styleColor2 = styleColor; let styleColor2 = styleColor;
var styleImage = ""; let styleImage = "";
if (tag.thumbnail.url != undefined) { if (tag.thumbnail.url != undefined) {
styleImage = "background-image: -webkit-linear-gradient(right bottom, rgba(20,46,51,.60) 0%,rgba(20,46,51,.90) 100%), url(" + tag.thumbnail.url + "); background-image: -moz-linear-gradient(right bottom, rgba(20,46,51,.60) 0%,rgba(20,46,51,.90) 100%), url(" + tag.thumbnail.url + "); background-image: -o-linear-gradient(right bottom, rgba(20,46,51,.60) 0%,rgba(20,46,51,.90) 100%), url(" + tag.thumbnail.url + ");"; styleImage = "background-image: -webkit-linear-gradient(right bottom, rgba(20,46,51,.60) 0%,rgba(20,46,51,.90) 100%), url(" + tag.thumbnail.url + "); background-image: -moz-linear-gradient(right bottom, rgba(20,46,51,.60) 0%,rgba(20,46,51,.90) 100%), url(" + tag.thumbnail.url + "); background-image: -o-linear-gradient(right bottom, rgba(20,46,51,.60) 0%,rgba(20,46,51,.90) 100%), url(" + tag.thumbnail.url + ");";
} else styleImage = "background-color: " + tag.color + "; background-image: -webkit-linear-gradient(right bottom, rgba(20,46,51,.5) 0%,rgba(20,46,51,.8) 100%); background-image: -moz-linear-gradient(right bottom, rgba(20,46,51,.5) 0%,rgba(20,46,51,.8) 100%); background-image: -o-linear-gradient(right bottom, rgba(20,46,51,.5) 0%,rgba(20,46,51,.8) 100%);" ; } else styleImage = "background-color: " + tag.color + "; background-image: -webkit-linear-gradient(right bottom, rgba(20,46,51,.5) 0%,rgba(20,46,51,.8) 100%); background-image: -moz-linear-gradient(right bottom, rgba(20,46,51,.5) 0%,rgba(20,46,51,.8) 100%); background-image: -o-linear-gradient(right bottom, rgba(20,46,51,.5) 0%,rgba(20,46,51,.8) 100%);";//styleColor.replace(/rgb/g, "rgba").replace(/\)/g, ",.85)");//"background-color: rgba(255,255,255,.25)";
var icnType = ""; let icnType = "";
var tmpType = tag.getMetadata("Rekall->Type"); let tmpType = tag.getMetadata("Rekall->Type");
if (tmpType.indexOf("application/msword") >= 0) icnType = "background-image:url(css/images/icn-word.png);"; if (tmpType.indexOf("application/msword") >= 0) icnType = "background-image:url(css/images/icn-word.png);";
else if (tmpType.indexOf("application/pdf") >= 0) icnType = "background-image:url(css/images/icn-pdf.png);"; else if (tmpType.indexOf("application/pdf") >= 0) icnType = "background-image:url(css/images/icn-pdf.png);";
else if (tmpType.indexOf("application/") >= 0) icnType = "background-image:url(css/images/icn-document.png);"; else if (tmpType.indexOf("application/") >= 0) icnType = "background-image:url(css/images/icn-document.png);";
...@@ -352,22 +266,22 @@ Project.prototype.analyse = function() { ...@@ -352,22 +266,22 @@ Project.prototype.analyse = function() {
else if (tmpType.indexOf("text/") >= 0) icnType = "background-image:url(css/images/icn-document.png);"; else if (tmpType.indexOf("text/") >= 0) icnType = "background-image:url(css/images/icn-document.png);";
else if (tmpType.indexOf("video/") >= 0) icnType = "background-image:url(css/images/icn-video.png);"; else if (tmpType.indexOf("video/") >= 0) icnType = "background-image:url(css/images/icn-video.png);";
var typeTxt = tmpType.split("/")[1].replace(/marker/g, "note"); let typeTxt = tmpType.split("/")[1].replace(/marker/g, "note");
var htmlHighlight = ""; let htmlHighlight = "";
htmlHighlight += "<div draggable=true class='flattentimeline_item flattentimeline_highlightitem' style='" + colorTransp + " " + styleImage + "'>"; htmlHighlight += "<div draggable=true class='flattentimeline_item flattentimeline_highlightitem' style='" + colorTransp + " " + styleImage + "'>";
htmlHighlight += "<div class='flattentimeline_title' style='" + textColor + "' title='" + tag.getMetadata("Rekall->Name") + "'>" + tag.getMetadata("Rekall->Name") + "</div>"; htmlHighlight += "<div class='flattentimeline_title' style='" + textColor + "' title='" + tag.getMetadata("Rekall->Name") + "'>" + tag.getMetadata("Rekall->Name") + "</div>";
if (tag.getMetadata("Rekall->Comments") != "") { if (tag.getMetadata("Rekall->Comments") != "") {
var tmpComments = tag.getMetadata("Rekall->Comments"); let tmpComments = tag.getMetadata("Rekall->Comments");
if (tmpComments.length > 150) { if (tmpComments.length > 150) {
tmpComments = tmpComments.substring(0, 150) + "..."; tmpComments = tmpComments.substring(0, 150) + "...";
} }
var tmpcount = 0; let tmpcount = 0;
var tmpIndex = tmpComments.indexOf("<br/>"); let tmpIndex = tmpComments.indexOf("<br/>");
while ((tmpcount < 3) && (tmpIndex != -1)) { while ((tmpcount < 3) && (tmpIndex != -1)) {
tmpcount++; tmpcount++;
tmpIndex = tmpComments.indexOf("<br/>", tmpIndex + 1); tmpIndex = tmpComments.indexOf("<br/>", tmpIndex + 1);
...@@ -404,21 +318,17 @@ Project.prototype.analyse = function() { ...@@ -404,21 +318,17 @@ Project.prototype.analyse = function() {
//Dom //Dom
$('#flattentimeline').append(function () { $('#flattentimeline').append(function () {
var styleColor = "background-color: " + tag.color + ";"; let styleColor = "background-color: " + tag.color + ";";
var textColor = "color: " + tag.color + ";"; let textColor2 = "color: rgba(255,255,255,.8)";
var textColor2 = "color: rgba(255,255,255,.8)";
var textColor3 = "color: rgba(0,0,0,.75);";
var colorTransp = styleColor.replace(/rgb/g, "rgba").replace(/\)/g, ",.75)");
var styleColor2 = styleColor; let styleColor2 = styleColor;
var styleImage = ""; let styleImage = "";
if (tag.thumbnail.url != undefined) { if (tag.thumbnail.url != undefined) {
styleImage = "background-image: url(" + tag.thumbnail.url + ");"; styleImage = "background-image: url(" + encodeURI(tag.thumbnail.url) + ");";//" opacity: 0.5;";
} else styleImage = "background-color: rgba(255,255,255,.25)"; } else styleImage = "background-color: rgba(255,255,255,.25)";
var icnType = ""; let icnType = "";
var tmpType = tag.getMetadata("Rekall->Type"); let tmpType = tag.getMetadata("Rekall->Type");
if (tmpType.indexOf("application/msword") >= 0) icnType = "background-image:url(css/images/icn-word.png);"; if (tmpType.indexOf("application/msword") >= 0) icnType = "background-image:url(css/images/icn-word.png);";
else if (tmpType.indexOf("application/pdf") >= 0) icnType = "background-image:url(css/images/icn-pdf.png);"; else if (tmpType.indexOf("application/pdf") >= 0) icnType = "background-image:url(css/images/icn-pdf.png);";
else if (tmpType.indexOf("application/") >= 0) icnType = "background-image:url(css/images/icn-document.png);"; else if (tmpType.indexOf("application/") >= 0) icnType = "background-image:url(css/images/icn-document.png);";
...@@ -429,7 +339,7 @@ Project.prototype.analyse = function() { ...@@ -429,7 +339,7 @@ Project.prototype.analyse = function() {
else if (tmpType.indexOf("video/") >= 0) icnType = "background-image:url(css/images/icn-video.png);"; else if (tmpType.indexOf("video/") >= 0) icnType = "background-image:url(css/images/icn-video.png);";
var html = ""; let html = "";
html += "<div draggable=true class='flattentimeline_item' title='" + tag.getMetadata("Rekall->Comments") + "' >"; html += "<div draggable=true class='flattentimeline_item' title='" + tag.getMetadata("Rekall->Comments") + "' >";
html += "<div class='flattentimeline_image' style='" + styleImage + "'></div>"; html += "<div class='flattentimeline_image' style='" + styleImage + "'></div>";
html += "<div class='flattentimeline_opacifiant' style='" + styleColor2 + "'></div>"; html += "<div class='flattentimeline_opacifiant' style='" + styleColor2 + "'></div>";
...@@ -460,11 +370,11 @@ Project.prototype.analyse = function() { ...@@ -460,11 +370,11 @@ Project.prototype.analyse = function() {
} }
}); });
} }
rekall.timeline.updateFlattenTimeline(); this.rekall.timeline.updateFlattenTimeline();
//Initialisation des captions //Initialisation des captions
if(rekall.videoPlayer.caption.updateCaption == undefined) { if (this.rekall.videoPlayer.caption.updateCaption == undefined) {
rekall.videoPlayer.caption({ this.rekall.videoPlayer.caption({
data: captions, data: captions,
setting: { setting: {
captionSize: 3, captionSize: 3,
...@@ -478,14 +388,13 @@ Project.prototype.analyse = function() { ...@@ -478,14 +388,13 @@ Project.prototype.analyse = function() {
} }
} }
}); });
} } else if ((captions) && (captions.length > 0)) {
else if((captions) && (captions.length > 0)) { this.rekall.videoPlayer.caption.loadNewCaption({data: captions});
rekall.videoPlayer.caption.loadNewCaption({data: captions});
} }
//Ajout des marqueurs sur la timeline //Ajout des marqueurs sur la timeline
if(rekall.videoPlayer.markers.removeAll == undefined) { if (this.rekall.videoPlayer.markers.removeAll == undefined) {
rekall.videoPlayer.markers({ this.rekall.videoPlayer.markers({
markerStyle: { markerStyle: {
'width': '7px', 'width': '7px',
'border-radius': '30%', 'border-radius': '30%',
...@@ -514,11 +423,13 @@ Project.prototype.analyse = function() { ...@@ -514,11 +423,13 @@ Project.prototype.analyse = function() {
return "Break overlay: " + marker.overlayText; return "Break overlay: " + marker.overlayText;
} }
}, },
onMarkerClick: function(marker) {}, onMarkerClick: function (marker) {
onMarkerReached: function(marker) {}, },
onMarkerReached: function (marker) {
},
markers: markers markers: markers
}); });
} else {
this.rekall.videoPlayer.markers.reset(markers);
} }
else
rekall.videoPlayer.markers.reset(markers);
} }
...@@ -47,7 +47,7 @@ function Rekall(options) { ...@@ -47,7 +47,7 @@ function Rekall(options) {
return url; return url;
} }
var defaultSettings = { let defaultSettings = {
_allowProjectDeletion: false, _allowProjectDeletion: false,
baseUrl: getDefaultBaseUrl() baseUrl: getDefaultBaseUrl()
} }
...@@ -63,8 +63,7 @@ Rekall.prototype.allowProjectDeletion = function(){ ...@@ -63,8 +63,7 @@ Rekall.prototype.allowProjectDeletion = function(){
if (arguments[0]) { if (arguments[0]) {
this.Settings._allowProjectDeletion = true; this.Settings._allowProjectDeletion = true;
$('#popupSettingsBtnDelete').attr('display', null); $('#popupSettingsBtnDelete').attr('display', null);
} } else {
else {
this.Settings._allowProjectDeletion = false; this.Settings._allowProjectDeletion = false;
$('#popupSettingsBtnDelete').hide(); $('#popupSettingsBtnDelete').hide();
} }
...@@ -88,11 +87,12 @@ Rekall.prototype.loadXMLFile = function() { ...@@ -88,11 +87,12 @@ Rekall.prototype.loadXMLFile = function() {
if (!this.Settings._allowProjectDeletion) { if (!this.Settings._allowProjectDeletion) {
$('#popupSettingsBtnDelete').hide(); $('#popupSettingsBtnDelete').hide();
}; }
;
this.baseUrl = url; this.baseUrl = url;
var thiss = this; let that = this;
rouletteStart(); rouletteStart();
$.ajax("php/file.php?r=project.xml", { $.ajax("php/file.php?r=project.xml", {
type: "GET", type: "GET",
...@@ -108,7 +108,7 @@ Rekall.prototype.loadXMLFile = function() { ...@@ -108,7 +108,7 @@ Rekall.prototype.loadXMLFile = function() {
// openAlert("Start by adding files to your project.", 60); // openAlert("Start by adding files to your project.", 60);
//} else { //} else {
if (rekall.project == undefined) if (rekall.project == undefined)
rekall.project = new Project(url); rekall.project = new Project(url, that);
rekall.project.loadXML($(this)); rekall.project.loadXML($(this));
//} //}
}); });
...@@ -130,7 +130,7 @@ Rekall.prototype.loadXMLFile = function() { ...@@ -130,7 +130,7 @@ Rekall.prototype.loadXMLFile = function() {
openAlert("Start by adding files to your project.", 60); openAlert("Start by adding files to your project.", 60);
} else { } else {
if (rekall.project == undefined) if (rekall.project == undefined)
rekall.project = new Project(url); rekall.project = new Project(url, that);
rekall.project.loadXML($(this)); rekall.project.loadXML($(this));
} }
}); });
...@@ -145,3 +145,96 @@ Rekall.prototype.loadXMLFile = function() { ...@@ -145,3 +145,96 @@ Rekall.prototype.loadXMLFile = function() {
} }
}); });
} }
Rekall.prototype.ensureVideoPlayerCreated = function (url, tech) {
if (undefined !== this.videoPlayer)
return false;
let that = this;
let techOrder = ["vimeo", "youtube", "html5"];
if (url.indexOf("youtube") >= 0) tech = "youtube";
if (url.indexOf("youtu.be") >= 0) tech = "youtube";
if (url.indexOf("vimeo") >= 0) tech = "vimeo";
if (url.indexOf("dailymotion") >= 0) tech = "dailymotion";
if (url.indexOf("dai.ly") >= 0) tech = "dailymotion";
if ((tech !== "") && (tech !== undefined))
techOrder = [tech, "html5"];
//Video
this.videoPlayer = videojs("video", {
"techOrder": techOrder,
"controls": true,
"autoplay": false,
"loop": "false",
"preload": "auto",
"sources": [
{
"type": "video/" + tech,
"src": url
}
]
}, function () {
$(".vjs-fullscreen-control").hide();
that.videoPlayer.on("durationchange", function () {
console.log("durationchange");
that.project.analyse();
that.videoPlayer.markers.initialize();
});
that.videoPlayer.on("ended", function () {
console.log("ended");
});
that.videoPlayer.on("error", function () {
console.log("error");
});
that.videoPlayer.on("firstplay", function () {
console.log("firstplay");
});
that.videoPlayer.on("fullscreenchange", function () {
console.log("fullscreenchange");
});
that.videoPlayer.on("loadedalldata", function () {
console.log("loadedalldata");
});
that.videoPlayer.on("loadeddata", function () {
console.log("loadeddata");
});
that.videoPlayer.on("loadedmetadata", function () {
console.log("loadedmetadata");
that.project.analyse();
});
that.videoPlayer.on("loadstart", function () {
console.log("loadstart");
});
that.videoPlayer.on("pause", function () {
console.log("pause");
});
that.videoPlayer.on("play", function () {
console.log("play");
});
that.videoPlayer.on("progress", function () {
console.log("progress");
});
that.videoPlayer.on("seeked", function () {
console.log("seeked");
});
that.videoPlayer.on("seeking", function () {
console.log("seeking");
});
that.videoPlayer.on("timeupdate", function () {
console.log("timeupdate");
that.timeline.update(that.videoPlayer.currentTime());
});
that.videoPlayer.on("volumechange", function () {
console.log("volumechange");
});
that.videoPlayer.on("waiting", function () {
console.log("waiting");
});
that.videoPlayer.on("resize", function () {
console.log("resize");
});
});
return true;
}
\ No newline at end of file
...@@ -21,7 +21,39 @@ ...@@ -21,7 +21,39 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
function Tags() { const Tags = (function() {
let flattenTimelineTags;
function getFlattenTimeLineTags() {
if(!flattenTimelineTags){
flattenTimelineTags = [];
}
return flattenTimelineTags;
}
function empty(){
flattenTimelineTags = [];
} }
Tags.flattenTimelineTags = new Array(); let sort = function() {
let localFlattenTimeline = getFlattenTimeLineTags();
localFlattenTimeline.sort(function (a, b) {
if (a.timeStart < b.timeStart) return -1;
if (a.timeStart > b.timeStart) return 1;
return 0;
});
}
let push = function(value) {
let localFlattenTimeline = getFlattenTimeLineTags();
localFlattenTimeline.push(value);
}
return {
getFlattenTimeLineTags: getFlattenTimeLineTags,
reset: empty,
sort: sort,
push: push
}
})();
...@@ -108,9 +108,9 @@ Sorting.prototype.analyseStart = function(tags) { ...@@ -108,9 +108,9 @@ Sorting.prototype.analyseStart = function(tags) {
this.valMin = 0; this.valMin = 0;
else { else {
this.categoriesIndex = 0; this.categoriesIndex = 0;
for (var key in this.categories) { for (let key in this.categories) {
this.categories[key].shoudBeRemoved = true; this.categories[key].shoudBeRemoved = true;
this.categories[key].tags = new Array(); this.categories[key].tags = [];
} }
} }
} }
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment