我有一个 id="videoElement"的 VideoElement,其中
$('#videoElement')[0].currentTime;
给我视频播放的时间。
在我的 Controller 上我有一个方法
setTime(time)
其中时间是视频元素 currentTime 值的值。
如何将此值传递给它?
最佳答案
找到了一种方法来做到这一点(在下面马修的评论之后,因为我的解决方案最初是将 Controller 绑定(bind)到 View ):
app.directive('currentVideoPlayTime', function () {
var linker = function (scope, element, attrs) {
element.bind('timeupdate', function () {
scope.currentPlayTime = element[0].currentTime;
});
};
return {
restrict:'A',
link:linker
}
});
关于javascript - 如何将视频元素当前时间传递到 Angularjs 的 Controller 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14022985/