Sound not playing


#1

I have finished exercise 8.
Although the code is correct according to Codecademy, no music is playing when clicked on 'start'.
how can I make a sound playing?


#2

@textninja51137,

Display the FULL code you are using...


#3








Start
Stop

SC.initialize({
client_id: 'YOUR_CLIENT_ID'
});

$(document).ready(function() {
SC.stream('/tracks/293', function(sound){
$('#start').click(function(e){
e.preventDefault();
sound.start();
});

    $('#stop').click(function(e){
        e.preventDefault();
        sound.stop();
        });
    });

});


#4

@textninja51137,

Please re-edit your Post

  • leave one blank-line above of your code
  • select your code in the Post
  • then =click= on the </>-symbol-of-this-editor

Your code will then be in a pre-code state
and you will be able to make/present the proper indentations.

or even better use
= http://discuss.codecademy.com/t/using-backticks-to-format-your-code/3697/2
[extra's]
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet


#5

My apologies. Herewith the code in correct format.
(HTML file)

<!doctype html>
<html>
    <head>
        <script src="//connect.soundcloud.com/sdk.js"></script>
        <script src="script.js"></script>
    </head>
    <body>
        <a href="#" id="start">Start</a>
        <a href="#" id="stop">Stop</a>
    </body>
</html>

(Script.js File)

SC.initialize({
  client_id: 'YOUR_CLIENT_ID'
});

$(document).ready(function() {
    SC.stream('/tracks/293', function(sound){
        $('#start').click(function(e){
            e.preventDefault();
            sound.start();
        });
        
        $('#stop').click(function(e){
            e.preventDefault();
            sound.stop();
            });
        });
});

#6

@textninja51137 Did you signup for a Soundcloud account? You should be having your own unique client id in this line:

SC.initialize({
  client_id: 'YOUR_CLIENT_ID'
});

#7

// Make sure you sign up on soundcloud http://soundcloud.com/you/apps
// The replace the client_id: 'YOUR_CLIENT_ID' with the client id generated from sound cloud platform.
// Example Something like this ac8717wee7492b68e6bd587a93b40574

SC.initialize({
  client_id: 'ac8717wee7492b68e6bd587a93b40574'
});

$(document).ready(function() {
 SC.stream('/tracks/293', function(sound) {
  $('#start').click(function(e) {
    e.preventDefault();
    sound.start();
  });
  $('#stop').click(function(e) {
      e.preventDefault();
    sound.stop();
  });
});
});

:eyeglasses: