I am trying to use Soundcloud api
for my application where user can create his/her own playlist of track . As a test case the example I am testing is almost exactly taken from the Soundcloud dev docs. below is my code
<script src="http://connect.soundcloud.com/sdk.js"></script>
<script>
// initialize client with app credentials
SC.initialize({
client_id: 'MY_CLIENT_ID',
redirect_uri: 'http://localhost.local/~****/sc/callback.html'
});
// initiate auth popup and create new playlist
SC.connect(function() {
SC.get('/me', function(me) {
console.log(me.username);
});
var tracks = [12573606].map(function(id) { return { id: id }; });
SC.post('/playlists', {
playlist: { title: 'My Playlist', tracks: tracks }
});
});
I already searched so many thing's in google but nothing helped me, actually i need temporary playlist so when user logout or close the browser playlist also delete . Any help would be appreciable.. thanx
You can make a playlist on SoundCloud using the platform's mobile app or desktop website, and it's a great way to save and organize your favorite music. To make a SoundCloud playlist, click or tap the ellipsis icon below any track and then select "Add to playlist."
SoundCloud playlists allow you to organize your favorite music tracks for your enjoyment or for sharing with others online. Anyone can create a playlist on SoundCloud for free by using the SoundCloud app or website. Plus, there's a variety of customization options available.
You can share a track or playlist through a message at anytime through the 'Share' button below it's waveform. Go to the Message tab and type in the Profile URL of your recipient. If you are following them, it will auto-fill their name for you.
Playlists are sets or 'albums' that you can create using your own or other people's tracks on SoundCloud. You can view playlists you have liked or created on your Collections page through the playlist tab. Or you can view just the playlists that you have created through the Playlist tab.
Can you try sending the client_secret => 'YOUR_CLIENT_SECRET'
as part of the initialize call
It doesn't look like there is such a thing in soundcloud to have a temporary playlist, you will need to delete the playlist on exit....
The best guess would be to see how to format your url to match when someone clicks on the delete button which you can find here: http://help.soundcloud.com/customer/portal/articles/282512-how-do-i-delete-tracks-from-my-account- I don't have an account so I can't test this part.
The key to creating the playlist is having the right track ids. It is possible if your having an issue that the track id doesn't exist and so it doesn't get added to the playlist.
<script src="http://connect.soundcloud.com/sdk.js"></script>
<script>
// initialize client with app credentials
SC.initialize({
client_id: 'MY_CLIENT_ID',
redirect_uri: 'http://localhost.local/~****/sc/callback.html'
});
// initiate auth popup and create new playlist
SC.connect(function() {
SC.get('/me', function(me) {
console.log(me.username);
});
var tracks = [12573606].map(function(id) { return { id: id }; });
SC.post('/playlists', {
playlist: { title: 'My Playlist', tracks: tracks }
});
//As you can see it is a simple array of ids of track
tracks = [21778201, 22448500, 21928809];
//To get all playlists remove limit and search each playlist name and grab id
SC.get('/me/playlists', { limit: 1 }, function(playlist) {
SC.put(playlist.uri, { playlist: { tracks: tracks } });
});
//Then to get all the tracks, please substitute the playlist id for 1234323:
SC.get('/playlists/1234323', function(playlist) {
for (var i = 0; i < playlist.tracks.length; i++) {
console.log(playlist.tracks[i].length);
}
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With