天下之事,必先处之难,而后易之。
君临
知我者谓我心忧,不知我者谓我何求

reference:http://www.schillmania.com/projects/soundmanager2/

SoundManager 2 makes it easier to play audio using JavaScript.

features:Using HTML5 and Flash, SoundManager 2 provides reliable cross-platform audio under a single JavaScript API. 

Speak and be heard

More sound, in more places

Despite being one of the senses, sound has largely been missing from the web due to inconsistent technology support. SoundManager 2 bridges this gap, making it easier to use audio across a growing variety of devices and platforms, both desktop and mobile.

Getting started is pretty easy, too.

HTML5 + flash hybrid

Complexity, reduced

Supporting HTML5 audio can be tedious in modern browsers, let alone legacy ones. With real-world visitors using browsers ranging from mobile Safari to IE 6 across a wide range of devices, there can be many support cases to consider.

SoundManager 2 gives you a single, powerful API that supports both new and old, using HTML5 audio where supported and optional Flash-based fallback where needed. Ideally when using SoundManager 2, audio "just works."

The ginsu knife: 11 KB*

Big features, small footprint

But wait, there's more!

Performance is an important metric, too. SoundManager 2 packs a comprehensive, feature-rich API into as little as11 KB over the wire when optimized; that's less than 8% of the original, uncompressed file size.

The source code is BSD-licensed and is provided in fully-commented, non-debug and compiler-optimized "minified" versions appropriate for development and production use.

Basic

Playable links and playlists

These demos use unordered lists with MP3 links that play in-place; the UI is easily customized via CSS.

Shiny

Data visualization features

The 360° player UI demo uses <canvas> and includes options for waveform and spectrum analysis data via Flash 9, adding beautiful visual feedback to the interface.

Experimental

Advanced prototypes

The Cassette Tape UI is a skinnable player based on the TDK MA-R90 cassette tape, a classic design from 1982.

Getting started

Basic SoundManager 2 set-up

Including the script, configuring the url and registering an onready() callback:

<script src="soundmanager2.js"></script>
<script>
soundManager.setup({
  // where to find flash audio SWFs, as needed
  url: '/path/to/swf-files/',
  onready: function() {
    // SM2 is ready to play audio!
  })
});
</script>

Upon execution of soundmanager2.js, SM2 will determine what Flash SWF to load (if any) based on the path defined in soundManager.url.

After successful initialization, soundManager.onready() will fire and sounds can be played.

By default, SM2 uses a Flash 8-based SWF build. Some additional features are available when using the Flash 9-based build.

For a live example, see the basic template demo.

Playing audio

Basic playback control

Once soundManager.onready() has fired, sounds can be loaded and played.

Creating and playing a sound object

// create "mySound"...
soundManager.createSound({
  id: 'mySound',
  url: '/path/to/an.mp3'
});

// ...and play it
soundManager.play('mySound');

Additional options and events can be specified when loading and playing sounds. For more examples of playback features, see API Demos.

 
posted on 2013-03-15 00:12  boonya  阅读(838)  评论(0编辑  收藏  举报

我有佳人隔窗而居,今有伊人明月之畔。
轻歌柔情冰壶之浣,涓涓清流梦入云端。
美人如娇温雅悠婉,目遇赏阅适而自欣。
百草层叠疏而有致,此情此思怀彼佳人。
念所思之唯心叩之,踽踽彳亍寤寐思之。
行云如风逝而复归,佳人一去莫知可回?
深闺冷瘦独自徘徊,处处明灯影还如只。
推窗见月疑是归人,阑珊灯火托手思忖。
庐居闲客而好品茗,斟茶徐徐漫漫生烟。

我有佳人在水之畔,瓮载渔舟浣纱归还。
明月相照月色还低,浅近芦苇深深如钿。
庐山秋月如美人衣,画堂春阁香气靡靡。
秋意幽笃残粉摇曳,轻轻如诉画中蝴蝶。
泾水潺潺取尔浇园,暮色黄昏如沐佳人。
青丝撩弄长裙翩翩,彩蝶飞舞执子手腕。
香带丝缕缓缓在肩,柔美体肤寸寸爱怜。
如水之殇美玉成欢,我有佳人清新如兰。
伊人在水我在一边,远远相望不可亵玩。