Jsonp调用网易云音乐API搜索播放歌曲

news/2024/11/24 13:58:43/

Jsonp调用网易云音乐API搜索播放歌曲

效果如下图:
基本就是正常的文件播放,暂停,停止,设置循环,随机播放,加速,减速,上一曲,下一曲,再多个选择本地文件加入到播放列表的功能。
然后想着给加个能搜索网络歌曲并且播放的功能,今天研究了一下,成果如下。

<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="UTF-8" />

  <title>demo</title>

  <style>

    #data{

      width: 400px;

      height: 300px;

      border: 1px solid #000;

      margin-top: 30px;

      word-break: keep-all;

      overflow: auto;

    }

    #data>img{

      margin: 20px;

    }

    #search{

      outline: none;

      margin: 20px;

    }

  </style>

</head>

<body>

  <audio id="audio" controls="controls">

    <source />

  </audio><br />

  <input id="search" type="text" /><label for="search">输入关键词后点击回车听歌</label><br />

  <input id="btn" type="button" value="下一曲" /><span>点击切换歌曲,循环获取的歌曲数</span>

  <div id="data">

    <img src="" alt="" />

  </div>

  <script>

    /**

     * [cb jsonp回调函数]

     * @param  {[type]}   data [description]

     * @return {Function}      [description]

     */

    function cb (data) {

      var oData = document.getElementById('data'),

          oBtn = document.getElementById('btn'),

          oAudio = document.getElementById('audio'),

          iNow = 0,   // 默认播放第一个歌曲

          str = '';

      if (data.code == 200) {  // 正确返回内容

        try {

          updateMusic();   // 更改信息框和播放搜索的第一个歌曲

          oBtn.onclick = function () {  // 点击显示下一首歌曲并播放

            iNow++;

            iNow %= data.result.songs.length;  // 控制只循环取到的几个歌曲

            updateMusic();

          };

        } catch(e) {

          oData.innerHTML = '';  // 出错清空列表

          oAudio.load();  // 搜索出错重载音频 以防出错时候还有音频在播放

          var oImg = document.createElement('img');  // 猜这是什么图片 -0-

          oImg.src = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkF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SbfUfGen+JdZ8Xanq8S6Ze2NjDC0VpBKm4M28OwB6uMZ5wPzuooCx9P/tGftHaH8QLL4keCvsn9u2UnjWfXPDPiGOcolnFIzLOu0qS8bgBgoxy5Y52gH6a8B/tgfDrwl4m0fwNH4t0+Lwz4astBgttek0pZLe5itLWRroBzEZRIzyAJ8uQwfbtLHd+Y1FAcqPu7Wv22vCniv4P+KrrUvC0E+tS6/ZiHRn8S6okl1bxwOguA6zh0CAIpVWCsWyQTzXGfsxftL6T4U8J6/wCBobHTvBOl3el65fX2pteEyalcvbOllb7n5UR7iqqGO44bAbJPyJRSuHKj7c+AP7YWknRvHjeMV1V9ePhK6aTU7/xjeKdXug8CrDFHnbBKyjh4/mURkDgmvlP4reNdM+IXi6XWtL0W50NJokWaG71WbUpZZBkGRppvnORtGD021x9KvSkNKwlFK3WigZ//2Q==';

          oData.appendChild(oImg);

        }

 

      }else{

        oData.innerHTML = '网易云音乐:(๑•ี_เ•ี๑)';  // 返回代码不是200

      }

      /**

       * [updateMusic 更新消息框显示内容和正在播放的歌曲]

       * @return {[type]} [description]

       */

      function updateMusic () {

 

        str = '歌曲id:' + data.result.songs[iNow].id + '<br />歌曲名:' + data.result.songs[iNow].name + '<br />演唱者:' + data.result.songs[iNow].artists[0].name + '<br />歌曲url:' + data.result.songs[iNow].audio + '<br />专辑图片:' + data.result.songs[iNow].album.picUrl;  // 显示歌曲部分信息

        oData.innerHTML = str;

        // oImg.src = data.result.songs[iNow].album.picUrl;

        var oImg = document.createElement('img');

        oImg.src = data.result.songs[iNow].album.picUrl;  //显示歌曲专辑图片

        oData.appendChild(oImg);

        oAudio.src = data.result.songs[iNow].audio;  // 设置播放音频的src

        oAudio.volume = 0.2;   // 修改一下音量 否则默认是1

        oAudio.play();  //播放指向的音频

      }

    }

 

    window.onload = function () {

      var oSearch = document.getElementById('search'),

          oData = document.getElementById('data');

      var iNum = 2;  // 2条歌曲数据

      oSearch.onkeydown = function (e) {  //回车按键编码为13

        if (e.which == 13 && oSearch.value.trim()) {  // 去除输入的空格

          var oScirpt = document.createElement('script');

          oScirpt.src = 'http://s.music.163.com/search/get/?type=1&filterDj=true&s=' + oSearch.value.trim() + '&limit=' + iNum + '&offset=0&callback=cb';  // |limit返回1|函数名为cb |type=1表示单曲 |offset偏移量 用于分页 | 过滤掉DJ那些乱的歌儿

          document.body.appendChild(oScirpt);  // 将有src属性的脚本加到页面

        }

      };

    };

  </script>

</body>

</html>

再就是浏览器上面读取本地文件的话,file格式的表单读取到的urlfakepath,所以我只能预先设置好一个路径,定位到一个文件夹,再只能选择这个文件夹里的音频文件,请问下大家有没做过类似的,有怎么解决的?


http://www.ppmy.cn/news/284425.html

相关文章

东芝计算机配置,东芝z830配置 东芝Z830-K02S参数【图文】

导语&#xff1a;电脑是我们生活当中的一个很重要的电子产品&#xff0c;电脑的品牌也是非常多的。今天给大家讲的就是 东芝 电脑品牌。对于这个电脑品牌了解朋友并不是很多&#xff0c;这款电脑的品牌知名度并不是很高&#xff0c;今天给大家讲述的就是东芝Z830-K02S(银色)电脑…

小米 Redmi 23.8 英寸电竞显示器评测

Redmi 电竞显示器 G24 采用 23.8 英寸 VA 面板&#xff0c;最高支持 165Hz 刷新率&#xff0c;屏幕分辨率为 1920*1080&#xff0c;响应时间 1ms。同时&#xff0c;该显示器支持支持 G-Sync 和 Free-Sync 功能&#xff0c;可保持显卡和显示器传输帧率同步&#xff0c;防止快速动…

手机屏幕为什么比电脑屏幕清晰?

不知道别人&#xff0c;反正我从第一次用电脑就觉得&#xff0c;电脑屏幕没有手机屏幕清晰&#xff0c;特别是游戏画质。 那时候也不懂&#xff0c;以为是游戏的开发者做的不用心&#xff0c;后来比较了多款电脑游戏&#xff0c;发现普遍画质比手机差很多。再后来进入了电子设…

手机刷新率测试网站

点击以下链接进入&#xff0c;即可进行手机刷新率测试&#xff1a; https://testufo.com/framerates#count3&backgroundstars&pps960 分享一个我的公众号&#xff0c;最近突然想玩公众号&#xff0c;之前做过一段时间前端开发&#xff0c;考虑到现在应用程序越来越多&…

手机屏幕分辨率真的是越高越清晰吗?

【现在手机厂商都在使用2K屏幕&#xff0c;真的是因为手机分辨率越高越清晰吗&#xff1f;】 我们先了解分辨率这个词。 分辨率主要决定了位图图像细节的精细程度&#xff0c;而如果我们的手机的分辨率越高&#xff0c;那么它所具备的像素就越多&#xff0c;图像就会越清晰。…

华为MateX2屏幕曝光:外翻变内折 120Hz高刷新率

从过去一年的市场反馈来看&#xff0c;折叠屏幕手机非常受欢迎&#xff0c;特别是对于许多黄牛而言&#xff0c;只要抓住它就可以赚钱。 当然&#xff0c;对于普通消费者而言&#xff0c;折叠屏也可以带来创新的体验。在5G网络中使用它并不是太酷。对于华为来说&#xff0c;华…

修改手机屏幕刷新率_手机屏幕刷新率真的越高越好吗?

近两年手机终端处于各种技术的井喷时期&#xff0c;其中屏幕刷新率这个概念被频繁提及&#xff0c;“高屏幕刷新率”成为了部分旗舰手机的又一卖点&#xff0c;不少科技达人也都在反复强调这个观点&#xff1a;屏幕刷新率与帧率必须要保持统一&#xff0c;才能达到理想的效果。…

修改手机屏幕刷新率_什么是屏幕刷新率?高刷新率屏幕为手机带来什么

【维文信TP世界】当年乔布斯说道&#xff1a;“当你距离屏幕10-12英寸时&#xff0c;300以上的ppi就分辨不出像素点。”显然&#xff0c;现在人们已经不再满足这“10-12英寸”距离的限制&#xff0c;更高分辨率的屏幕不断出现。 而屏幕发展到今天除了分辨率外&#xff0c;更多的…