From 023008b60931361a868766207693069e5c90c12d Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Tue, 27 Oct 2020 00:32:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EGoogle=20Chrome=E5=AA=92?= =?UTF-8?q?=E4=BD=93=E6=8E=A7=E5=88=B6=E5=99=A8=EF=BC=88APP=E5=B0=B1?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E9=B8=BD=E4=BA=86=EF=BC=89=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4music.html=E4=B8=AD=E7=9A=84log=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/html/body/nas/music.html | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) 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' + }] }) }