gpt4 book ai didi

angularjs - 使用 Videogular API 逐帧向前/向后移动视频

转载 作者:行者123 更新时间:2023-12-05 05:25:53 25 4
gpt4 key购买 nike

有没有办法使用 Videogular API 逐帧搜索视频?如果不是,最好的解决方法是什么?

谢谢!

最佳答案

我自己遇到了这个需求。这是我创建的指令。请注意,我对帧率进行了硬编码,并且仅在播放器暂停时显示控件。

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);
}
);

}
}
}
]);

关于angularjs - 使用 Videogular API 逐帧向前/向后移动视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29319074/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com