Reputation: 1755
I made a website where if the user clicks, it should plays a video. and clicking on same should pause,
whenever I tried to pause it is showing
Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause().
here is my plnkr
Can someone assist me?
I tried
setTimeout(function () {
var item = $(".myVideosClick")[0];
if (!item.paused) {
item.pause();
}
}, 100);
but it is not working for me.
Upvotes: 0
Views: 247
Reputation: 906
Instead of setTimeout
use $timeout
service which is the Angular wrapper for setTimeout
and it uses $scope.$apply
inside.
Also, instead of using JQuery
for click
event binding use ng-click
directive. Example:
$scope.videoClickHandler = function(){
//do on click logic
}
Also you can try to make bigger timeout, 300 works well in my case.
Upvotes: 1