新增Google Chrome媒体控制器(APP就可以鸽了)

移除music.html中的log输出
This commit is contained in:
Yutousama 2020-10-27 00:32:55 +08:00
parent ec31aa01b9
commit 023008b609

View File

@ -71,8 +71,7 @@
} catch (e) { } catch (e) {
localhost = "" localhost = ""
} }
console.log(localhost) //localhost = "http://192.168.31.88:8000";
// localhost="http://116.22.200.20:8000"
layui.use(['table', 'element'], function () { layui.use(['table', 'element'], function () {
let table = layui.table; let table = layui.table;
let element = layui.element; let element = layui.element;
@ -94,7 +93,6 @@
}) })
table.on('rowDouble(music)', function (obj) { table.on('rowDouble(music)', function (obj) {
//obj 同上 //obj 同上
console.log(obj.data) //得到当前行元素对象
if (obj.data.dir) { if (obj.data.dir) {
listTable.reload({ listTable.reload({
where: { where: {
@ -119,10 +117,8 @@
window.open(localhost + "/nas/music/play.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&random=false&filePath=" + new Base64().encode(data.file)) window.open(localhost + "/nas/music/play.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&random=false&filePath=" + new Base64().encode(data.file))
} }
} else if (obj.event === 'play') { } 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) { $.get(localhost + "/nas/music/list.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&type=all&path=" + new Base64().encode(data.file), function (obj) {
let json = JSON.parse(obj); let json = JSON.parse(obj);
console.log(json)
if(json.code===0){ if(json.code===0){
playIndex=0; playIndex=0;
musicLib=json.data; musicLib=json.data;
@ -134,11 +130,10 @@
} }
}); });
element.on('nav(menus)', function (elem) { element.on('nav(menus)', function (elem) {
console.log(elem); //得到当前点击的DOM对象
}); });
}); });
}) });
let player = $.AudioPlayer; let player = $.AudioPlayer;
player.init({ player.init({
@ -234,10 +229,24 @@
$('#artist').html("艺术家:" + json.data.artist) $('#artist').html("艺术家:" + json.data.artist)
$('#album').html("专辑:" + json.data.album) $('#album').html("专辑:" + json.data.album)
$('#composer').html("作曲:" + json.data.composer) $('#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) { $.get(localhost + "/nas/music/image.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&fileName=" + fileName, function (data) {
let json = JSON.parse(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'
}]
}) })
} }