HTML中嵌入MP3播放器

这篇博客介绍了如何在HTML中嵌入MP3播放器,包括如何替换歌曲URL、是否自动播放、是否循环播放以及是否显示播放控制按钮的设置方法,并提供了一个在Chrome浏览器下测试成功的HTML格式示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Notes for Music Player
-replace song.mp3 with the url of the song you want
-delete autoplay="autoplay" if you don't want the song to start when the page loads
-delete loop="loop" if you only want the song to play once
-delete controls="controls" if you don't want the play/pause button


方法1:最直接的html格式,在chrome下测试成功

<audio controls="controls" loop="loop" autoplay="autoplay"> <source src="song.mp3" type="audio/mpeg" /> Your browser does not support the audio element. </audio>

<zaudio src="http://mp3file21.mafengwo.net/201304290000/45bac052cacc6ae561f2173107c69878/M00/9D/73/wKgB3FFz7IaAeoOEAF-WgFrqx4k442.mp3" controls autoplay>
<body><video controls="" autoplay="" style="margin: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0;" name="media" src="http://mp3file21.mafengwo.net/201304290000/45bac052cacc6ae561f2173107c69878/M00/9D/73/wKgB3FFz7IaAeoOEAF-WgFrqx4k442.mp3"></video></body>

方法2: 参考马蜂窝网站,可以调播放器颜色
<script> swfobject.embedSWF("/swf/player.swf?soundFile=http://mp3file21.mafengwo.net/201304290000/45bac052cacc6ae561f2173107c69878/M00/9D/73/wKgB3FFz7IaAeoOEAF-WgFrqx4k442.mp3&bg=0xeeeeee&leftbg=0xFAB303&lefticon=0xFFFFFF&rightbg=0xF89213&rightbghover=0xaf2910&righticon=0xFFFFFF&righticonhover=0xffffff&text=0x666666&slider=0x666666&track=0xFFFFFF&border=0x666666&loader=0x9FFFB8&autostart=yes&loop=yes", "music_show", "310", "30", "9.0.0", "expressInstall.swf","",{wmode: "transparent",allowscriptaccess:"always"}); </script>

方法3: 参考Weebly网站
<embed src="http://www.weebly.com/weebly/apps/audioPlayer2.swf?soundFile=http://mp3file21.mafengwo.net/201304290000/45bac052cacc6ae561f2173107c69878/M00/9D/73/wKgB3FFz7IaAeoOEAF-WgFrqx4k442.mp3" type="application/x-shockwave-flash" wmode="transparent" height="40" width="290" controls = "autoplay"></embed>
    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值