Skip to content
Snippets Groups Projects
Commit 2e17d185 authored by Loïs Poujade's avatar Loïs Poujade
Browse files

change playback rate according to annotations

parent 4d991696
Branches
Tags
1 merge request!87change playback rate according to annotations
Pipeline #1013 failed
...@@ -185,6 +185,9 @@ ...@@ -185,6 +185,9 @@
<div class="popupRightItem" id="popupLink" title="Link"></div> <div class="popupRightItem" id="popupLink" title="Link"></div>
<textarea class="popupInput" id="popupLinkInput" type="text"></textarea> <textarea class="popupInput" id="popupLinkInput" type="text"></textarea>
<div class="popupRightItem" id="popupSpeed" title="Speed"></div>
<textarea class="popupInput" id="popupSpeedInput" type="text"></textarea>
<!-- <div class="popupRightItem separationHDark editmode"></div> --> <!-- <div class="popupRightItem separationHDark editmode"></div> -->
</td> </td>
</tr> </tr>
......
...@@ -30,6 +30,7 @@ function Tag(document) { ...@@ -30,6 +30,7 @@ function Tag(document) {
this.timeStart = 0; this.timeStart = 0;
this.timeEnd = 1; this.timeEnd = 1;
this.color = "#FFFFFF"; this.color = "#FFFFFF";
this.shown = false;
} }
Tag.keyToOpenAfterLoading = undefined; Tag.keyToOpenAfterLoading = undefined;
......
...@@ -44,6 +44,11 @@ Timeline.prototype.stop = function() { ...@@ -44,6 +44,11 @@ Timeline.prototype.stop = function() {
Timeline.prototype.rewind = function(timeCurrentOffset) { Timeline.prototype.rewind = function(timeCurrentOffset) {
rekall.videoPlayer.rewind(); rekall.videoPlayer.rewind();
} }
Timeline.prototype.chspeed = function(speed) {
rekall.videoPlayer.playbackRate(speed);
console.debug('changing playback speed to ' + speed);
}
Timeline.prototype.toggle = function() { Timeline.prototype.toggle = function() {
if(this.state) if(this.state)
...@@ -63,6 +68,20 @@ Timeline.prototype.updateFlattenTimeline = function() { ...@@ -63,6 +68,20 @@ Timeline.prototype.updateFlattenTimeline = function() {
var progress = 0; var progress = 0;
var timeEndExtended = tag.timeStart + max(2, tag.timeEnd - tag.timeStart); var timeEndExtended = tag.timeStart + max(2, tag.timeEnd - tag.timeStart);
var should_shown = (this.timeCurrent >= tag.timeStart && this.timeCurrent <= tag.timeEnd);
if (!tag.shown && should_shown) {
tag.shown = true;
if (tag.getMetadata('Rekall->Speed')) this.chspeed(Number(tag.getMetadata('Rekall->Speed')));
} else if (tag.shown && !should_shown) {
tag.shown = false;
if (tag.getMetadata('Rekall->Speed')) {
this.chspeed(1);
console.debug('speed was ' + tag.getMetadata('Rekall->Speed'));
}
}
if(this.timeCurrent <= tag.timeStart) if(this.timeCurrent <= tag.timeStart)
progress = this.timeCurrent - tag.timeStart; progress = this.timeCurrent - tag.timeStart;
else if((tag.timeStart < this.timeCurrent) && (this.timeCurrent < timeEndExtended)) else if((tag.timeStart < this.timeCurrent) && (this.timeCurrent < timeEndExtended))
......
...@@ -462,6 +462,13 @@ function setEditionControls() { ...@@ -462,6 +462,13 @@ function setEditionControls() {
closeInputs(); closeInputs();
}); });
$("#popupSpeed").click(function(event){
event.stopPropagation();
closeInputs();
$(this).hide();
$("#popupSpeedInput").show().focus();
});
$("#popupLegende").click(function(event){ $("#popupLegende").click(function(event){
event.stopPropagation(); event.stopPropagation();
closeInputs(); closeInputs();
...@@ -758,6 +765,16 @@ function closeInputs() { ...@@ -758,6 +765,16 @@ function closeInputs() {
if(newComment!="") $("#popupLegende").html(newComment.replace(/\n/gi, "<br/>")).removeClass("empty"); if(newComment!="") $("#popupLegende").html(newComment.replace(/\n/gi, "<br/>")).removeClass("empty");
else $("#popupLegende").html("+ Add a comment").addClass("empty"); else $("#popupLegende").html("+ Add a comment").addClass("empty");
} else if($(this).attr("id")=="popupSpeedInput") {
var keyDoc = $(this).parent().attr("keydoc");
var newSpeed = $(this).val().trim();
$(this).val(newSpeed);
setMetaFromDom(keyDoc, "Rekall->Speed", newSpeed);
if(newSpeed!="") $("#popupSpeed").html(newSpeed).removeClass("empty");
else $("#popupSpeed").html("+ Set video speed during this annotation ").addClass("empty");
} else if($(this).attr("id")=="popupAuthorInput") { } else if($(this).attr("id")=="popupAuthorInput") {
var keyDoc = $(this).parent().attr("keydoc"); var keyDoc = $(this).parent().attr("keydoc");
...@@ -986,6 +1003,10 @@ bgColorLeft = getTagGradientColor(tag); ...@@ -986,6 +1003,10 @@ bgColorLeft = getTagGradientColor(tag);
var endVerb = convertToTime(tag.getTimeEnd()); var endVerb = convertToTime(tag.getTimeEnd());
$("#popupTCout").html(endVerb); $("#popupTCout").html(endVerb);
var speed = tag.getMetadata("Rekall->Speed");
if((speed)&&(speed!="")) $("#popupSpeed").html(speed).removeClass("empty");
else $("#popupSpeed").html("+ Set video speed during this annotation").addClass("empty");
var comments = tag.getMetadata("Rekall->Comments"); var comments = tag.getMetadata("Rekall->Comments");
if((comments)&&(comments!="")) $("#popupLegende").html(comments).removeClass("empty"); if((comments)&&(comments!="")) $("#popupLegende").html(comments).removeClass("empty");
else $("#popupLegende").html("+ Add a comment").addClass("empty"); else $("#popupLegende").html("+ Add a comment").addClass("empty");
...@@ -1018,6 +1039,7 @@ bgColorLeft = getTagGradientColor(tag); ...@@ -1018,6 +1039,7 @@ bgColorLeft = getTagGradientColor(tag);
$("#popupLegendeInput").val(""+comments.replace(/<br\/>/gi, '\n')); $("#popupLegendeInput").val(""+comments.replace(/<br\/>/gi, '\n'));
$("#popupAuthorInput").val(""+author); $("#popupAuthorInput").val(""+author);
$("#popupLinkInput").val(""+link); $("#popupLinkInput").val(""+link);
$("#popupSpeedInput").val(""+speed);
var highlight = tag.getMetadata("Rekall->Highlight"); var highlight = tag.getMetadata("Rekall->Highlight");
if(highlight=="true") { if(highlight=="true") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment