SC.initialize({
client_id: "YOUR_CLIENT_ID"
});
SC.stream("/tracks/23132314", {
autoPlay: true,
ontimedcomments: function(comments){
// we only handle the first comment for this timestamp
var firstComment = comments[0];
var text = "";
$("<li/>").text(
firstComment.user.username + " (@" +
Math.floor(firstComment.timestamp / 1000) + "s): " +
firstComment.body
).appendTo("#comments");
}
});
<ol id="comments"></ol>
#comments {
width: 400px;
margin: auto;
margin-top: 30px;
font-family: "Helvetica";
font-size: 14px;
}
#comments li {
border-bottom: 1px solid #eee;
padding-bottom: 5px;
padding-top: 5px;
}
External resources loaded into this fiddle: