I'm fairly new to JS and I'm having trouble getting audio that is currently playing to pause or stop using the SoundCloud JavaScript SDK. I'm using a MEAN stack.
In the 'ready' function I initialize the SC player:
SC.initialize({
client_id: "my_client_ID",
redirect_uri: "http://ift.tt/1v0LYB0",
});
...
$('#trackList table tbody').on('click', 'td a.linkplaytrack', playTrack);
$('#trackList table tbody').on('click', 'td a.linkpausetrack', pauseTrack);
The playTrack function works fine and audio starts playing:
function playTrack(event){
event.preventDefault();
SC.stream("/tracks/293", function(sound){
sound.play();
});
};
But for some reason the pauseTrack function doesn't work:
function pauseTrack(event){
event.preventDefault();
SC.stream("/tracks/293", function(sound){
sound.pause();
});
};
Any help, insights or suggestions would be appreciated!
Aucun commentaire:
Enregistrer un commentaire