Web播放器学习笔记(一) audioPlay
最近收集一些播放音频的播放器,包括mp3、wav等
1、audioplay
(1)先下载 audioplay.swf 的Flash文件
(2)配置需要播放的config文件
<?xml version="1.0" encoding="utf-8"?>
<audioplay>
<config>
<!--
AudioPlay - visithttp://www.strangecube.com/audioplay/ for more
Here is an example multiple players configuration (set unique id for each player)
-->
<player playerid="1"> //配置参数说明
<!-- set player's background color -->
<backgroundColor>0xffffff</backgroundColor>
<!-- music file -->
<musicfile>music.mp3</musicfile>
<!-- how many times music will be played (0 - unlimited) -->
<repeatTimes>1</repeatTimes>
<!-- should music starts automatically –> //是否循环播放
<autostart>no</autostart>
<!-- button directory -->
<buttondir>buttons/classic</buttondir>
<!-- player mode - playstop or playpause -->
<mode>playstop</mode>
<!-- send stop command to other players ? -->
<sendstop>yes</sendstop>
<!-- listen stop command from other players ? -->
<listenstop>yes</listenstop>
<!-- track id - must be unique -->
<trackid>first</trackid>
<!-- which player (trackid) will be started after this player will end playing -->
<nexttrack>second</nexttrack>
<!-- use background color specified in 'backgroundColor' tag - no transparency -->
<usebgcolor>no</usebgcolor>
<!-- player alpha fade in duration -->
<fadeindur>1000</fadeindur>
<!-- volume 0-100 -->
<mastervol>90</mastervol>
<!-- you could specify URL of external scripts that will be used when play/pause/stop action is invoked (default: none) -->
<playscriptfile></playscriptfile>
<pausescriptfile></pausescriptfile>
<stopscriptfile></stopscriptfile>
<!-- autostart delay in ms (default 500)-->
<autostartdelay>1000</autostartdelay>
<!-- external interface feature (player could be controlled by JS play(), stop(), pause() methods) - default: no -->
<einterface>yes</einterface>
<!-- inititial buffering - music download starts immediately after player loads -->
<initbuf>no</initbuf>
<!-- images could be customized by changing images in button directory -->
</player>
<!--
For multiple instances of AudioPlay add separate player tags with unique playerid attribute
then add '?playerid=X' to every AudioPlay url in object/embed tags. For example: 'audioplay.swf?playerid=2'
-->
<player playerid="2">
<musicfile>music.mp3</musicfile>
<repeatTimes>1</repeatTimes>
<autostart>no</autostart>
<buttondir>buttons/classic</buttondir>
<mode>playpause</mode>
<sendStop>yes</sendStop>
<listenstop>yes</listenstop>
<trackid>second</trackid>
<nexttrack>third</nexttrack>
<fadeindur>1000</fadeindur>
<mastervol>90</mastervol>
<playscriptfile></playscriptfile>
<pausescriptfile></pausescriptfile>
<stopscriptfile></stopscriptfile>
<autostartdelay>1000</autostartdelay>
<einterface>yes</einterface>
<initbuf>no</initbuf>
</player>
</config>
</audioplay>
(3)在页面中编辑调用方法
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="30" height="30" id="player1">
<PARAM NAME=movie VALUE="audioplay.swf?playerid=1">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=wmode VALUE="transparent">
<PARAM NAME="allowScriptAccess" value="always" />
<embed wmode="transparent" src="audioplay.swf?playerid=1" quality=high width="30" height="30" name="player1" allowScriptAccess="always"
align="" TYPE="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>
function getPlayer(movieName)
{
if (navigator.appName.indexOf("Microsoft") != -1)
{
return window[movieName];
}
else
{
return document[movieName];
}
}
function play1()
{
getPlayer('player1').playMusic();
}
function stop1()
{
getPlayer('player1').stopMusic();
}
(4)播放器资料
一个按钮AudioPlay是一个免费的MP3播放器基于Flash技术。简单的上传AudioPlay和音乐文件到你的网络主机帐户……而且所有的:-)。编辑配置(配置。xml或看跌期权直接向URL)。你可以自定义背景颜色,循环设置和自动启动选项。您可以自定义播放器播放/停止键的准备您自己的按钮图像。如果你正在寻找你的声音片段演示球员或背景音乐播放器为您的网站然后AudioPlay非常适合你。此外AudioPlay非常轻量级的。
AudioPlay还可作为在线音乐播放器。简单的把适当的信息AudioPlay的发电机。下一个生成的代码复制并粘贴到您的页面。玩家可以用在你的博客上,myspace,主页,无论你想要的。
浙公网安备 33010602011771号