//My SoundCloud JS//
//Initializes the SC API
SC.initialize({  client_id: 'b0a55481ef5bdd9abaf4f638ee6af6d6',
  redirect_uri: ''
              });
//Authorizes Users
$(document).ready(function() {
  $('a.connect').click(function(e) {
    e.preventDefault();
    SC.connect(function() {
      SC.get('/me', function(me) {
        $('#username').html(me.username);
      });
    });
  });
});

//Pulls a Track
$(document).ready(function() {
    SC.get('/tracks/288735235', function(track){
        SC.oEmbed(track.permalink_url, document.getElementById('player'));
   // SC.stream('/tracks/293', function(sound){
   // $('#start').click(function(e) {
    //e.preventDefault();
    //sound.start();
  //});
  //$('#stop').click(function(e) {
    //e.preventDefault();
    //sound.stop();
    //});
    });
});

//Creates a List of Tracks Via Genre
$(document).ready(function() {
  SC.get('/tracks', { genres: 'Hip-Hop' }, function(tracks) {
    $(tracks).each(function(index, track) {
      $('#results').append($('<li></li>').html(track.title + ' - ' + track.genre));
    });
  });
});

