html網頁音樂播放器內建播放清單

來源:互聯網
上載者:User

標籤:style   blog   class   code   c   java   

基於網頁的音樂播放器demo  http://pan.baidu.com/s/1dDgm7HR

自己diy了一個手機端線上音樂播放器示範地址http://shanxi2014.com/zhuandizhi/dom.php

全面支援手機端瀏覽器。

主要修改引用路徑(不要修改檔案相對存放地址)

第二就是正則拼接參數了

<script src="/city/js/libs/jquery-1.10.2.min.js"></script><script src="/city/js/libs/jquery-ui.min.js"></script><script src="/city/js/libs/bootstrap.min.js"></script><!-- Style CSS --><link href="/city/css/bootstrap.css" media="screen" rel="stylesheet"><link href="/city/style.css" media="screen" rel="stylesheet"><!-- General Scripts --><script src="/city/js/general.js"></script><!-- custom input --><script src="/city/js/jquery.customInput.js"></script><!-- Placeholders --><script src="/city/js/jquery.powerful-placeholder.min.js"></script><script>    jQuery(document).ready(function($) {        if($("[placeholder]").size() > 0) {            $.Placeholder.init();        }    });</script><!-- CarouFredSel  --><script src="js/jquery.carouFredSel-6.2.1-packed.js"></script><!-- Lightbox prettyPhoto --><link href="css/prettyPhoto.css" rel="stylesheet"><script src="js/jquery.prettyPhoto.js"></script><!-- Video Player --><link href="/city/css/video-js.css" rel="stylesheet"><script src="/city/js/video.js"></script><script>    videojs.options.flash.swf = "js/video-js.swf";</script><!-- Audio Player --><link href="/city/css/jplayer.css" rel="stylesheet"><script src="/city/js/jquery.jplayer.min.js"></script><script src="/city/js/jplayer.playlist.min.js"></script><script type="text/javascript">    //<![CDATA[    $(document).ready(function(){        new jPlayerPlaylist({            jPlayer: "#jquery_jplayer_1",            cssSelectorAncestor: "#jp_container_1"        }, [<?php if(strlen($a[2])>6){foreach ($a as $va) {        echo $tittle.$va;};}?>        {title:"<div class=‘item-image‘><img src=‘http://bsp1.yokacdn.com/starimg/300_400/1d5969ee7bd06ff1cb30fd951be154dd.jpg‘  /></div>終於等到你",m4a:"http://cc.stream.qqmusic.qq.com/C100003GF7MY2P0fz7.m4a?fromtag=52"},{title:"<div class=‘item-image‘><img src=‘http://bsp1.yokacdn.com/starimg/300_400/1d5969ee7bd06ff1cb30fd951be154dd.jpg‘  /></div>陪你走到底",m4a:"http://cc.stream.qqmusic.qq.com/C100003GX33X2aLY1R.m4a?fromtag=52"},{title:"<div class=‘item-image‘><img src=‘http://bsp1.yokacdn.com/starimg/300_400/1d5969ee7bd06ff1cb30fd951be154dd.jpg‘  /></div>如果愛下去",m4a:"http://cc.stream.qqmusic.qq.com/C10000395SnV0rl1hZ.m4a?fromtag=52"},{title:"<div class=‘item-image‘><img src=‘http://bsp1.yokacdn.com/starimg/300_400/1d5969ee7bd06ff1cb30fd951be154dd.jpg‘  /></div>天下無雙",m4a:"http://cc.stream.qqmusic.qq.com/C100002sjtbA1K4ASF.m4a?fromtag=52"}         ], {            swfPath: "js",            supplied: "oga, mp3,m4a",            wmode: "window",            smoothPlayBar: false,            keyEnabled: false        });    });    //]]></script>

搜狗音樂地址擷取

<?php$query=$_GET[‘s‘];$q= mb_convert_encoding($query,"GBK","UTF-8");$ew=urlencode($query);$jsrc = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q={$ew}";$json = file_get_contents($jsrc);$jset = json_decode($json, true);$src=$jset["responseData"]["results"][0]["url"];$image="<div class=‘item-image‘><img src=‘http://bsp1.yokacdn.com/starimg/300_400/1d5969ee7bd06ff1cb30fd951be154dd.jpg‘  /></div>";$query=urlencode($query);$url="http://mp3.sogou.com/music.so?query={$query}";function curl_get($url, array $get = NULL, array $options = array()){    $defaults = array(            CURLOPT_URL => $url. (strpos($url, ‘?‘) === FALSE ? ‘?‘ : ‘‘). http_build_query($get),            CURLOPT_HEADER => 0,            CURLOPT_RETURNTRANSFER => TRUE,            CURLOPT_TIMEOUT => 4    );    $ch = curl_init();    curl_setopt_array($ch, ($options + $defaults));    if( ! $result = curl_exec($ch))    {        trigger_error(curl_error($ch));    }    curl_close($ch);    return $result;}$html=curl_get($url,array(), array());iconv("GB2312","UTF-8//IGNORE",$html);    $c="+onclick=\"qqDownload.*http://cc\.stream\.qqmusic\.qq\.com.*\.m4a\?fromtag=52+i";    $elemment=$html;        if (preg_match_all($c, $elemment,$matches)){$i=0;$a = array();$t=array();foreach ($matches[0] as $val) {        $val=explode("@@", $val, 11);        $t[$i]="<a href=\"{$val[10]}\" class=\"btn btn-red btn-round\"><span >{$val[1]}</span></a><br/>";        $i++;                $val[1]=$image.$val[1];        $a[$i]="{title:\"{$val[1]}\",". "m4a:\"{$val[10]}\"},";                        }    }?>

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.