The Newgrounds audio player in HTML/CSS/Javascript.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
small
video
visualizer
.gitattributes
.gitignore
LICENSE.txt
README.md
index.html

README.md

NewgroundsHTMLAudio

The Newgrounds audio player in HTML/CSS/Javascript by Dave Pagurek

Versions

The visualizer version includes some basic visualizations and a basic API to add more visualizations.

The small version is made for embeds, stretches to fit its container's width using CSS, and is reprogrammed to be more modular since it doesn't need any video capabilities.

The video version is a basic prototype that adapts the visualizer version for use with a <video> tag, including basic fullscreen support.

Usage for Visualizer Version

Create a new AudioPlayer with the following params: ```javascript new AudioPlayer(autoplay:Boolean, loop:Boolean, visualizerFunction:Function); ```

The visualizerFunction takes two parameters:

function (soundData:Uint8Array, stage:CanvasRenderingContext2D) {}

The soundData array has the volumes for each frequency of the spectrum. The stage context is a reference to the visualizer canvas's 2d context, ready to be drawn onto.

When making a visualizer, you can access the following properties of the AudioPlayer variable you made:

  • width:Number
  • height:Number
  • playing:Boolean