diff --git a/web/html/body/nas/music.html b/web/html/body/nas/music.html index f08bfa8..a0aafec 100644 --- a/web/html/body/nas/music.html +++ b/web/html/body/nas/music.html @@ -71,8 +71,7 @@ } catch (e) { localhost = "" } - console.log(localhost) - // localhost="http://116.22.200.20:8000" + //localhost = "http://192.168.31.88:8000"; layui.use(['table', 'element'], function () { let table = layui.table; let element = layui.element; @@ -94,7 +93,6 @@ }) table.on('rowDouble(music)', function (obj) { //obj 同上 - console.log(obj.data) //得到当前行元素对象 if (obj.data.dir) { listTable.reload({ where: { @@ -119,10 +117,8 @@ window.open(localhost + "/nas/music/play.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&random=false&filePath=" + new Base64().encode(data.file)) } } else if (obj.event === 'play') { - console.log(data.file) $.get(localhost + "/nas/music/list.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&type=all&path=" + new Base64().encode(data.file), function (obj) { let json = JSON.parse(obj); - console.log(json) if(json.code===0){ playIndex=0; musicLib=json.data; @@ -134,11 +130,10 @@ } }); element.on('nav(menus)', function (elem) { - console.log(elem); //得到当前点击的DOM对象 }); }); - }) + }); let player = $.AudioPlayer; player.init({ @@ -234,10 +229,24 @@ $('#artist').html("艺术家:" + json.data.artist) $('#album').html("专辑:" + json.data.album) $('#composer').html("作曲:" + json.data.composer) - }) + navigator.mediaSession.metadata=new MediaMetadata({ + title:json.data.title, + artist:json.data.artist, + album:json.data.album + }); + navigator.mediaSession.setActionHandler('nexttrack', function () { + // 用户点击了“下一首”媒体通知图标 + playNext(); + }); + }); $.get(localhost + "/nas/music/image.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&fileName=" + fileName, function (data) { let json = JSON.parse(data); - $('#img').attr("src", "data:image/png;base64," + json.data) + $('#img').attr("src", "data:image/png;base64," + json.data), + navigator.mediaSession.metadata.artwork=[{ + src:"data:image/png;base64," + json.data, + type: 'image/png', + sizes: '128x128' + }] }) }