首页 > 代码库 > 去年方百度首页播放器写的一个js代码,先记录一下,不支持火狐了,改天用autio改改
去年方百度首页播放器写的一个js代码,先记录一下,不支持火狐了,改天用autio改改
播放器内核使用的是 object 或embed
刚刚测试了下,最新的火狐不支持了,IE 360还能用,改天换成audio来做吧
这里先记录下来
支持下一曲,暂停,开始
使用方法很简单:
该代码很简单,使用js实现,使用方法很简单
1、引入css:<link href="http://www.mamicode.com/css/StyleSheet.css" rel="stylesheet" type="text/css" />
2、引入js:<script src="http://www.mamicode.com/js/JScript.Music.js" type="text/javascript"></script>
3、放一个装载播放器的div容器<div id="music_panel"></div>
4、
<script type="text/javascript"> var MUSIC = new Music([ { "Panel": "music_panel", "Width": "380", "Height": "100", "AutoStart": true, "Image": "webImg/album/20122027052035203540.jpg", "Url": "/webImg/music/20123927053922392250.mp3", "Music": [ { "Name": "我们都一样", "Singer": "张杰", "SingerLink": "javascript:void(0)", "Ablum": "xxx", "AblumLink": "javascript:void(0)", "AutoStart": true, "Image": "http://imgsrc.baidu.com/baike/pic/item/03087bf40ad162d976c9f6b511dfa9ec8a13cd70.jpg", "Url": "http://data1.act3.qq.com/2008-09-30/12/b8be62ce0758e958e05b24618befbef9.mp3?http%A4%84%B8A%E3%BF%C1%B9z/vfile.home.news.cn/music/public/vd2/200811/4.mp3" }, { "Name": "我的歌声里", "Singer": "曲婉婷", "SingerLink": "javascript:void(0)", "Ablum": "xxx", "AblumLink": "javascript:void(0)", "AutoStart": true, "Image": "http://apps3.bdimg.com/store/static/kvt/e4c9252bf227c4a6427756b84dfba94f.jpg", "Url": "http://attachments.cngba.com/attachments/forum/201204/21/112846rgjkj55gyijerhji.mp3" }, { "Name": "可能", "Singer": "李霄云", "SingerLink": "javascript:void(0)", "Ablum": "xxx", "AblumLink": "javascript:void(0)", "AutoStart": true, "Image": "http://picache.baidu.com/media?wd=CDA79D2E8563D8F5C0BE992128D3F9A7A92166DA4BE8CEE0642B4C7EBE9D354508F9A47D62B57D5D18D9DE8B517FBB7B&src=http://imgsrc.baidu.com/baike/pic/item/1b4c510fd9f9d72a5b3a31a3d42a2834349bbb35.jpg&def=local://neverfill", "Url": "http://zhangmenshiting.baidu.com/data2/music/27920867/2792075982800128.mp3?xcode=ae9bd6c273a9739430b0581eb794ca53" }, { "Name": "依然爱你", "Singer": "王力宏", "SingerLink": "javascript:void(0)", "Ablum": "xxxx", "AblumLink": "javascript:void(0)", "AutoStart": true, "Image": "http://apps3.bdimg.com/store/static/kvt/0aabc03602d739babdae4a1c6c07277f.jpg", "Url": "http://music.huoxing.com/upload/20120702/1341183292277_4670.mp3?" }, { "Name": "寻找铁达尼", "Singer": "朴一泽", "SingerLink": "javascript:void(0)", "Ablum": "xxxx", "AblumLink": "javascript:void(0)", "AutoStart": true, "Image": "http://picache.baidu.com/media?wd=CDA79D2E8563D8F5C0BE992128D3F9A776D7488E0BBE49C433893DD621D3B49A7F219FD54AAB780D488CDC128145EFA3&src=http://imgsrc.baidu.com/baike/abpic/item/a9d3fd1f4134970af3dad7ab95cad1c8a6865d8d.jpg&def=local://neverfill", "Url": "http://video11.ifeng.com/video06/2012/04/18/3bd579b3-7aa4-4d52-b228-4b1314797315.mp3" }, { "Name": "桃花运", "Singer": "杨钰莹", "SingerLink": "javascript:void(0)", "Ablum": "xxxx", "AblumLink": "javascript:void(0)", "AutoStart": true, "Image": "http://picache.baidu.com/media?wd=CDA79D2E8563D8F5C0BE992128D3F9A7A92166DA4BE8CEE0642B4C7EBE9D35459686508B4F8C9720A15CA53121973AC4&src=http://data.yule.sohu.com/star/pic/star/1/1500/default.jpg&def=local://neverfill", "Url": "http://m.61song.cn/SongJin.net/yyy02/%CC%D2%BB%A8%D4%CB.wma?nbsp=&vsid=44b90565dc99188f6ad9deb9" }, { "Name": "我好喜欢你", "Singer": "六哲", "SingerLink": "javascript:void(0)", "Ablum": "xxxx", "AblumLink": "javascript:void(0)", "AutoStart": true, "Image": "http://b.hiphotos.baidu.com/ting/pic/item/71cf3bc79f3df8dcc0010bd8cd11728b471028be.jpg", "Url": "http://music1.tianya.cn/upmusicfile/2010/4/28/287846_33011389.MP3" } ] }]); </script>
本文转载地址/附下载:传送门
更多代码访问:程序吧
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。