只是想知道如何以及在哪里放置适用于SoundCloud API更新跟踪功能的artwork_data
<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 :(得分: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 || '');
};