This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Using the SoundCloud API Forum

View Course » View Exercise

1185 points
Bce180d619315eb6c7a657d0fa795a0d?s=140&d=retro
Submitted by
Arthur
almost 2 years ago

'Script error.' ?

Hi all,
Seems like i can't get this bit to work, it renders a "Script error." message although the corrector doesn't find anything wrong with the code.

Here's the script.js tab content:

SC.initialize({
  client_id: '340f063c670272fac27cfa67bffcafc4',
  redirect_uri: 'http://external.codecademy.com/soundcloud.html'
});

$(document).ready(function() {
    $('#startRecording a').click(function(e) {
        $('#startRecording a').hide();
        $('#stopRecording a').show();
        e.preventDefault();
        updateTimer(0);
        SC.record({
            progress: function(ms, avgPeak) {
                updateTimer(ms);
            }
        });
    });
    $('#stopRecording a').click(function(e) {
        e.preventDefault();
        $('#playBack').show();
        $('#upload').show();
        $('#stopRecording').hide();
        SC.recordStop();
    });
});

// Helper methods for our UI.

function updateTimer(ms) {
  // update the timer text. Used when we're recording
  $('.status').text(SC.Helper.millisecondsToHMS(ms));
}

So here's how it goes: after clicking on the "Start recording" link in the preview frame, the link is successfully hidden, then the '0,00' value appears, but nothing else follows, except the console underneath displaying the "Script error." message.

This is the third exercise in a row on SoudCloud API's that doesn't work as intended, although the code gets validated fine when submitted.
Is there something wrong ?