javascript - Responsive voice jquery plugin not working inside loop -
im trying make responsive voice read out each sentences , there must 1 minute gap between each readouts.
function read(){ responsivevoice.speak('قلم','arabic female'); } var = [1,2,3]; $(a).each( function(){ settimeout(function(){ read(); }, 1000); });
currently plays once , in other 2 loops getting error
uncaught (in promise) domexception: play() request interrupted call pause().
i can't make read passed dynamically
maybe problem used .each()
method not correctly because $(a)
try target selector not array.
from jquery.each() doc:
jquery.each( array, callback ) where
array: type: array - array iterate over.
callback: type: function( integer indexinarray, object value ) - function executed on every object.
so, try this:
$.each( a, function(){ settimeout(function(){ read(); }, 1000); });
hope you.
Comments
Post a Comment