jsmp3播放暂停切换静音特效代码下载


jsmp3播放暂停切换静音特效代码下载
jsmp3播放暂停切换静音特效代码下载以及mp3播放暂停、切换静音等js/jquery网页特效代码下载。

1. 引入JS

<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>

2. HTML代码

<script type="text/javascript">
$(document).ready(function(){
	//设置MP3文件播放器的例子
	var playerMp3 = new SWFObject("swf/player.swf","myplayer1","0","0","9");
	playerMp3.addVariable("file","http://www.51qianduan.com/static/images/20090619170715799.mp3");
	playerMp3.addVariable("icons","false");
	playerMp3.write("player1");
	//创建一个JavaScript对象,允许我们将事件发送到Flash Player
	var player1 = document.getElementById("myplayer1");
	var mute1 = 0;
	var status1 = $("#status1");
	//事件播放MP3文件
	$("#play1").click(function(){
		player1.sendEvent("PLAY","true");
		status1.text("播放中....");
	});
	$("#pause1").click(function(){
		player1.sendEvent("PLAY","false");
		status1.text("暂停");
	});
	$("#mute1").click(function(){
		if(mute1 == 0){
			player1.sendEvent("mute","true");
			mute1 = 1;
			$(this).removeClass("current");
		}
		else{
			player1.sendEvent("mute","false");
			mute1 = 0;
			$(this).addClass("current");
		}
	});
	//安装FLV文件播放器
	var playerFlv = new SWFObject("swf/player.swf","myplayer2","400","300","9");
	playerFlv.addVariable("screencolor","white");
	playerFlv.addVariable("image","videos/preview.jpg");
	playerFlv.addVariable("file","http://www.51qianduan.com/static/images/1234124deo.flv");
	playerFlv.write("player2");
	//创建一个JavaScript对象,允许我们将事件发送到Flash Player
	var player2 = document.getElementById("myplayer2");
	var mute2 = 0;
	//FLV文件播放器事件
	$("#play2").click(function(){
		player2.sendEvent("PLAY","true");
		player1.sendEvent("PLAY","true");
		status1.text("播放中....");
	});
	$("#pause2").click(function(){
		player2.sendEvent("PLAY","false");
	});
	$("#mute2").click(function(){
		if(mute2 == 0){
			player2.sendEvent("mute","true");
			mute2 = 1;
			$(this).removeClass("current");
		}
		else{
			player2.sendEvent("mute","false");
			mute2 = 0;
			$(this).addClass("current");
		}
	});
});
</script>
<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
a{cursor:pointer;color:#296ba5;text-decoration:none;}
body{line-height:14px;font-size:12px;background:#fff;font-family:Tahoma, Verdana, Arial, Helvetica, sans-serif;margin:0pt;cursor:default;}
#container{width:600px;margin:40px auto;text-align:left;}
#container h1{font-weight:700;font-size:18px;line-height:32px;height:32px;position:relative;border-bottom:1px dotted #6b9ef1;color:#5f95ef;margin-bottom:1em;}
#container h1 .lightbtn{position:absolute;top:0;right:0;z-index:9999;}
div.content span{display:block;font-weight:700;color:#898989;margin-top:10px;}
div.content{padding:0 10px 20px 30px;margin-bottom:20px;}
div.content a{margin:0 4px 0 4px;color:#9a9a9a;}
div.content a:hover{color:#5f95ef;text-decoration:underline;}
div.content div.status{font-size:10px;border-bottom:1px solid #a5a5a5;margin-bottom:4px;color:#5f95ef;}
#player2{margin-bottom:10px;}
</style>
	<div id="container">
		<h1><a target="_blank" href="http://www.51qianduan.com/">麦路客商城天戈遥控飞机</a>播放FLV文件</h1>
		<div class="content">
			<p id="player2">将播放这段媒体</p>
			<a id="play2">播放</a>
			<a id="pause2">暂停</a>
			<a id="mute2">切换静音</a>
		</div>
		<h1>free loop 播放MP3文件</h1>
		<div class="content">
			<p id="player1">将播放这段媒体</p>
			<div id="status1" class="status">暂停</div>
			<a id="play1">播放</a>
			<a id="pause1">暂停</a>
			<a id="mute1">切换静音</a>
		</div>
	</div>

相关推荐

发表评论

相关文章