Volume control:

Within the HTML5 Audio API you can add sound nodes to influence the sound file. The most simple of these is the gain node which is used for volume.

To use the gain node, you create it then attach the sound file to the node and then the node to the sound destination instead of just attaching the sound file to the destination. You can then change the gain nodes value on the fly, like I have done with my slider.

The play/pause button was even simpler, create a button that checks if the sound is playing if it is then stop it other play it.

Also as a temporary fix to the bug i have used a setTimeout function to call the play ambient track function 2 seconds after the init is called.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s