I have a list that is unordered, and whenever I click on a ListItem, it triggers the setActive() function.
<li ng-repeat="slide in data" ng-click="setActive(slide.slideIndex)">
<span class="listItemText">
<b>{{slide.slideIndex + 1}}. </b>{{slide.Title}}
</span>
</li>
The setActive() function looks like this:
$scope.setActive = function(id)
{
$scope.currentIndex = id;
}
Clicking on the List Items updates an image:
<img id="slide" ng-src="resources/slides/slide{{currentIndex + 1}}.jpg" />
Everything with that is working smoothly.
However, the issue arises with a video player where I need to update $scope.currentIndex at specific times.
I attempted the following approach:
player.addEventListener("timeupdate", function()
{
currentTime = player.currentTime;
angular.forEach($scope.data, function(value, key)
{
if (currentTime >= $scope.data[key].time && currentTime <= $scope.data[key].time + 0.3 && $scope.currentIndex != key)
{
console.log("load id:" + key);
$scope.setActive(key); //Using the same function as for List Items
}
});
});
The console.log is functioning properly and logging at the cue points. However, the image does not update until I MouseOver the list. It then updates according to the current $scope.currentIndex. I am stuck on this issue. Any suggestions?