audiojs

A cross-browser javascript wrapper for the html5 audio tag

  • 所有者: kolber/audiojs
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

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

Bower package

bower install audiojs

License

audio.js is released under the MIT license. Included MP3 and Ogg files are Creative Commons licensed tracks from Bensound.com

主要指標

概覽
名稱與所有者kolber/audiojs
主編程語言JavaScript
編程語言Ruby (語言數: 5)
平台
許可證MIT License
所有者活动
創建於2010-12-01 23:19:16
推送於2018-09-25 12:29:23
最后一次提交2017-03-07 01:33:54
發布數2
最新版本名稱1.0.1 (發布於 )
第一版名稱1.0.0 (發布於 )
用户参与
星數2.1k
關注者數86
派生數439
提交數217
已啟用問題?
問題數213
打開的問題數99
拉請求數21
打開的拉請求數7
關閉的拉請求數17
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?