javascript - How do I implement audio controls on this audio visualizer that uses HTML5 Web Audio API? -


i know how put audio controls when you're importing source of audio so:

  <audio src="audio.mp3" id="audio" controls="true"></audio> 

what's different audio visualizer im trying fiddle uses audio, user has upload (test demo below). know is- how can put audio controls can play, pause, next/previous song, volume(with mute , unmute), , loop button(if selected, loops current played/uploaded audio file) audio file?

and of course if audio stops, im assuming visualizer stop too? wouldn't know because don't know how put audio controls.

index.php code:

<!doctype html> <html>  <head>     <meta name="description" content="html5 audio spectrum visualizer">     <title>html5 audio api showcase | audio visualizer</title>     <link type="text/css" rel="stylesheet" href="style/style.css">  </head>  <body>     <div id="wrapper">         <div id="filewrapper" class="file_wrapper">             <div id="info">                 html5 audio api showcase | audio viusalizer             </div>             <label for="uploadedfile">drag&drop or select file play:   </label>             <input type="file" id="uploadedfile"></input>         </div>         <div id="visualizer_wrapper">             <canvas id='canvas' width="800" height="350"></canvas>         </div>     </div>     <footer>         <small></small>     </footer>     <script type="text/javascript" src="js/html5_audio_visualizer.js">     </script> </body> </html> 

the full javascript file (long) :

https://github.com/wayou/html5_audio_visualizer/blob/master/js/html5_audio_visualizer.js

that's wanted know.

thanks.

original author & code(css included): https://github.com/wayou/html5_audio_visualizer demo: http://wayou.github.io/html5_audio_visualizer/

look @ _visualize method on line 125 of source. in method audiobuffersourcenode holds file has been loaded.

on line 136 start() , stop() methods being used on audio node. if reference audiobuffersourcenode out of library can call these methods play , pause sound.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -