javascript - preventing audio from playing then allowing after end with jquery function -


I am working on a simple audio player for a site. I just want to play it and stop the capabilities. I am working on it so that it can play, so set it so that the selector will try to play Kent overlap. After this is over, I want to re-select the selector. It does not seem like this to do so, maybe I do not understand where the bind and unbind should be kept.

  function play magic () {var audio element = document. Secrete element ('audio'); Var audio alarmsrc = $ (this) .attr ('data-audio-src'); AudioElement.setAttribute ('src', audioElementSrc); $ .Get (); AudioElement.addEventListener ("loadeddata", function () {audioElement.play ();}, true); $ ('. Pause'). Click (function () {audioElement.pause ();}); AudioElement.addEventListener ("Game", function () {$ ('. Play'). Unbind ('click');}); AudioAlement.Advent Allisoner ("Ended", function () {$ ('. Play'). Bind ('click');}); } $ (Function (e) {$ ('. Play'). Click (Playmusic);});  

The problem is that when you reboot the event, you do not bind any listener You must explicitly point to the function which calls to call again. There is no rebound for the event of this break.

Check this Bela:

I have added these incident listeners:

  audioElement.addEventListener ("stop", reboot); AudioElement.addEventListener ("Finish", Rebund);    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -