Good day. Tell me how to implement something like playing music on the site and user playlists like this: http://tidido.com/RU/RU At the moment there is a script that allows you to run music in the background, when you navigate through the pages everything works, and how to adapt it for the above task.

$$r(function() { $$i({ create:'script', attribute: { 'type':'text/javascript', 'src':'http://nagon.net/modules/NRMSLib/NRMSLib.js' }, insert:$$().body, onready:function() {//выполняю только после загрузки скрипта $$e.add($$('mp3button'),'click',playmp3rand);//добавляю событие кнопке после загрузки скрипта } }); }); var playmp3rand = function (event) { //запукаю случайную музыку modules.sound.stop();//останавливаю если что то уже играет switch($$s.randnum(1,3)) {//случайное число от 1 до 3 включительно case 1: modules.sound.start({'music': 'http://goldenland.onfind.net/2/1/'+$$s.randnum(1,8)+'.mp3'}); break; case 2: modules.sound.start({'music': 'http://goldenland.onfind.net/2/2/'+$$s.randnum(1,12)+'.mp3'}); break; case 3: modules.sound.start({'music': 'http://goldenland.onfind.net/2/3/'+$$s.randnum(1,4)+'.mp3'}); break; } $$('sound_s_el_m').$$('width','1px').$$('height','1px').$$('overflow','hidden');//эти параметры трогать не нужно } 
  • In the same way, as well as on the site resulted on the link. Add the necessary data- * attributes to the tags and, when clicked, read information about the music being played from them. It remains only to substitute the read link into your module. - Alex Krass
  • I see their data-id = "sport" - music from a specific section is played (sport) / So, using data- I can slip the script with the necessary information about what kind of music to play? - Batyabest
  • Yes, with the help of data- * attributes you can attach and then read the information and slip the script. Considering that in data- * instead of * you can write whatever you want (data-id = "bla-bla", data-music = "bla-bla", data-fuuuuuu = "bla-bla"), there is a large choice of use. It remains only to generate them somewhere on the server. - Alex Krass
  • I had another problem here - I can’t store Mouzon on my server - we need more power)) But through api VK you can get a link to the track, and here’s how to substitute this url? The answer comes from a response: [{id: 145228616, owner_id: 126110704, artist: 'Nirvana', title: 'Smells Like Teen Spirit', duration: 301, url: ' cs9-4v4.vk ... / 01a07936d18bc3. mp3 ', lyrics_id: 94933876, genre_id: 1}] - Batyabest

0