2014-03-12 54 views
2

只是想知道如何以及在哪裏放置artwork_data爲的SoundCloud API更新跟蹤功能的Javascript:如何在的SoundCloud API更新曲目藝術品

<script src="http://connect.soundcloud.com/sdk.js"></script> 
     <script> 
     SC.initialize({ 
     client_id: 'YOUR_CLIENT_ID', 
     redirect_uri: 'YOUR_REDIRECT_URI' 
     }); 

    // connect and update track data 
     SC.connect(function() { 
     SC.get('/tracks/13198684', function(track) { 
     SC.put(track.permalink_url, { track: { 
     description: 'This track was recorded in Berlin', 
     genre: 'Electronic', 
     artwork_data: '/path/to/image/to/upload' 
    }}); 
    }); 
}); 

我不知道有關artwork_data以上,我只是耿耿於懷。如果有人有一個想法,這將是非常有益的謝謝!

回答

0

老兄!用它作爲參考:https://github.com/abitlog/react.js-voice-audio-player。簡而言之,您必須手動更改圖像的url路徑。您有這個功能可能對你造成了:

const url = require('url'); 

const formatCover = function (coverUri, size = 't300x300', format = '.png') { 
    const { host, protocol, pathname, search } = url.parse(coverUri); 

    return protocol + '//' + host + pathname.split('.')[0].split('-').slice(0, -1).join('-') + '-' + size + format + (search || ''); 
}; 
相關問題