Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Please note these two lines in jquery.audiocontrol.js.</p> <pre><code>91. addListeners(window); 92. audio.playFlash(currentTrack + options.defaultMediaExtension); </code></pre> <p>in <strong>addListeners</strong> function three event handlers are being added which are meant for html5 audio, but here <strong>window</strong> is being passed to that function. As a result event listeners are getting added for window. Then <strong>audio.playFlash</strong> causes an error as the player is not ready like you have mentioned. But this error invokes <strong>onError</strong> function and it shows the error message written for html5audio element. </p> <p>EDIT: I explored the code further and found out that it is happening because of the following code in the index page, line 12</p> <pre><code>$(document).ready(function(){ $(this).audiocontrol(); $('.audioButton').click(); }); </code></pre> <p>Triggering of the click event results in immediately playing the audio, which will work only for html5 audio. It takes a few seconds to embed the swf as swfobject.js is loaded dynamically. So this code should be like</p> <pre><code>$(document).ready(function(){ $(this).audiocontrol( { readyCallback:function(){ $('.audioButton').click(); } } ); }); </code></pre> <p>and in jquery.audiocontrol.js, after line 125 add ( for html5 audio)</p> <pre><code>if(options.readyCallback){ options.readyCallback.call(); } </code></pre> <p>and in line 136, pass it as the callback function of embedSWF. The last parameter of embedSWF is a callback function which will be invoked when the SWF is ready,</p> <pre><code>swfobject.embedSWF(options.flashAudioPlayerPath, options.playerContainer, "0", "0", "9.0.0", "swf/expressInstall.swf", false, false, {id:options.flashObjectID}, options.readyCallback); </code></pre> <p>EDIT: Don't know why the external interface function is not available even after getting ready callback. I doubt its because of the 0 width and 0 height. Anyway giving the function loadFlash (line 141) as given below fixed the issue. Its working now.</p> <pre><code>function loadFlash() { swfobject.embedSWF(options.flashAudioPlayerPath, options.playerContainer, "1", "1", "9.0.0", "swf/expressInstall.swf", false, false, {id:options.flashObjectID}, function(){ if(options.readyCallback){ setTimeout(options.readyCallback, 150); } }); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload