diff options
-rw-r--r-- | player.js | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -200,12 +200,21 @@ function downloadHistory() { const historyArray = getHistory(); let element = document.createElement("a"); + let playListData = '#EXTM3U'; + historyArray.forEach((musicData) => { + playListData = `${playListData} + +#EXTINF:${(musicData.duration/60000).toFixed(2)}, ${musicData.title} +https://retrowave.ru/${musicData.streamUrl} +`; + }); + element.setAttribute( "href", - "data:application/json;charset=utf-8," + - encodeURIComponent(JSON.stringify(historyArray)) + "data:audio/x-mpegurl;;charset=utf-8," + + encodeURIComponent(playListData) ); - element.setAttribute("download", "history.json"); + element.setAttribute("download", "retrowave_playlist.m3u"); element.style.display = "none"; document.body.appendChild(element); |