Use mp3 metadata or HTML to display artwork and track name on iPhone lock screen

后端 未结 2 1644
Happy的楠姐
Happy的楠姐 2021-01-21 03:24

When you lock an iphone after using safari / chrome etc., when an mp3 file is playing, it displays blank artwork and a hard link to the mp3 file location, which looks quite ugly

2条回答
  •  不知归路
    2021-01-21 03:47

    If you want to display image on lock screen from your page you cannot do this, only iOS apps can. If you want to play music in background(while safari is closed, not killed) you can do it like this

    var mp3 = document.createElement("audio");
       mp3.setAttribute('src', 'http://example.com/track.mp3');
       mp3.load();
       document.documentElement.appendChild(mp3);
       mp3.play();
       mp3.pause() // Pause
    

提交回复
热议问题