Is there a way to seek the video frame by frame using Videogular API? If not, what would be the best work around?
Thanks!
Is there a way to seek the video frame by frame using Videogular API? If not, what would be the best work around?
Thanks!
Came across a need for this myself. Here is the directive I created. Note that I hardcoded the framerate and I'm only showing the controls when the player is paused.
app.directive("vgFrameButtons", ["VG_STATES",
function (VG_STATES) {
return {
restrict: "E",
require: "^videogular",
template:
'<button class="iconButton" ng-click="prevFrame()"><i class="fa fa-angle-double-left"></i></button>' +
'<button class="iconButton" ng-click="nextFrame()"><i class="fa fa-angle-double-right"></i></button>',
link: function (scope, elem, attr, API) {
var frameTime = 1 / 29.97;
scope.prevFrame = function () {
API.seekTime((API.currentTime / 1000) - frameTime);
};
scope.nextFrame = function () {
API.seekTime((API.currentTime / 1000) + frameTime);
};
scope.$watch(
function () {
return API.currentState;
},
function (newVal) {
var display = newVal == VG_STATES.PAUSE ? "table-cell" : "none";
elem.css("display", display);
}
);
}
}
}
]);