Git Product home page Git Product logo

audiojs's Introduction

audio.js

audiojs is a drop-in javascript library that allows HTML5's <audio> tag to be used anywhere. It uses native <audio> where available and falls back to an invisible flash player to emulate it for other browsers. It also serves a consistent html player UI to all browsers which can be styled used standard css.

It plays mp3s. No ogg. Because, lets be honest, in the real world, no one really exports ogg files. Sadly, that means Opera and Firefox get flash audio. Hopefully they can add mp3 support soon.

Usage

  1. Put audio.js, player-graphics.gif & audiojs.swf in the same folder.

  2. Include audio.js:

     <script src="/audiojs/audio.js"></script>
    
  3. Initialise audiojs:

     <script>
       audiojs.events.ready(function() {
         var as = audiojs.createAll();
       });
     </script>
    
  4. Then you can use <audio> wherever you like in your HTML:

     <audio src="/mp3/juicy.mp3" preload="auto" />
    

Bugs / Contributions

  • Report a bug
  • To contribute or send an idea, github message me or fork the project

Build

On OSX, you should install closure compiler following the instructions in Ben's gist.

Then you can run rake compile from root directory and it will package audio.js into audio.min.js.

Compiling Flash from the command line

If you want to mess around with the flash-side of things, you will need to be able to compile the .as file into a .swf.

Using the Flex SDK (which is free), flash movies can be compiled directly from the command line. It makes life that little bit less painful.

Installing mxmlc

  1. Download and unzip the current 'Milestone Release' 'Open Source Flex SDK' from: http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4

  2. Copy the bin folder to /usr/local/bin/flex/bin/

  3. Add /usr/local/bin/flex/bin/ to your PATH

Compiling the SWF

Run the following command from within the audiojs folder.

mxmlc audiojs.as

audiojs's People

Contributors

benschwarz avatar dwickwire avatar gunn avatar keating avatar kolber avatar mikesherov avatar toolmantim avatar weikinhuang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.