感谢 listen1 的项目的作者和开发者做出如此强大的音乐播放器 项目地址
感谢Hello_wshuo提供的方案思路和代码
可以下载我已经改好的源码(在selfUse支线)
本代码对Hello_wshuo提供的方法进行了简化并且改成了在列表页下载
效果
1,首先照样更改js/controller里的navigation.js文件
选中内容为新增的代码(就是在angular模块内添加以下代码)
下面这段方便复制
$scope.download_music = (song) => {
MediaService.bootstrapTrack(
song,
(bootinfo) => {
const mp3url = bootinfo.url
const strs = mp3url.split('.'); //字符分割
const houzhui = strs[strs.length-1].substring(0, 3);
const filename = song.title +" - "+song.artist;
const request = new XMLHttpRequest();
request.open("GET", mp3url, true);
request.responseType = 'blob';
request.onload=function(e){download(x.response, filename+'.'+houzhui);};
request.send(