J
J
jackie chan2015-11-14 20:04:05
JavaScript
jackie chan, 2015-11-14 20:04:05

How to add audio in VK to the user on the page?

Hello everyone, so I've been sitting all day today trying to make it possible to add audio to the user's page, after reading the documentation from VK, I need the id of the song id of the one who uploaded it, it's all there, but here's how to correctly implement this method if there is already some code

function recommendate(){
    VK.Api.call('audio.getRecommendations', {count: '1000'}, function(r) {
      if(r.response) {
        $('#playlist').empty().append($.map(r.response, function(song){
          return '<li><a href="'+ song.url +'"><b>'+song.artist+'</b> - '+ song.title +'<span class="label">'+ song.aid +' - '+ song.owner_id+'</span></a></li>'
        }))
      }
    });
};
Which outputs audio, any info will come in handy)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Rubanyuk, 2015-11-14
@pstn

audio.add method . In response, the id of the audio recording on the page of the authorized user will be sent

VK.Api.call('audio.add', { audio_id: 161291628, owner_id: -9880494 }, function (data) {
  if (data.response) {
    console.log(data.response);
  }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question