ScriptEd Year 2 Curriculum project - Using the Souncloud API
- Search: Simply type in the mood you are currently in and a song will be generated based on that mood
- Hear: We grab all of our songs directly from Soundcloud, so there are millions of selections.
- Explore: Using Soundmood, you can find hundreds of songs based on unique mood
- Quantity & Quality: Soundmood has a selection of many different emotions/mood, so good luck entering one that doesn't exist.
#Assignment
####Make Soundmood work! You will need to do the following:
###1) Play a track
Play a track using the Soundcloud API (Reading the Soundcloud documentation will help you figure out how to play a track)
- Read the Soundcloud documentation to figure out how to stream (or play) a track
HTTP API GUIDE -> Playing Sounds -> Streaming sounds
- Use
SC.stream
to play a track
- Hint: you need to know something about the track
- Fill out the
playOneTrack()
function
- Hint: don’t forget to add
playOneTrack()
todocument.ready()
###2) Add click handlers
Add a click handler for the #go
button -- make the #go
button DO something by adding a click handler!
- Hint: you can use Javascript or jQuery for this
- Hint: call the click handler
playOneTrack()
to play a song when you click the button
###3) Find a track based on the user's mood and play it
Find a track based on the user’s mood and play it -- make the click handler play a song based on the user's input!
- Fill out the
goClicked()
function! It should: - Get the user's input from the
#mood
field - Call
searchTracks(mood)
. * Hint: there are helper methods inscript.js
that you can use! - Fill out
searchTracks(mood)
- Read API documentation to find
SC.get
- Fill out
searchTracks()
to find the track for the user's mood usingSC.get
- Make sure to
console.log()
the response from the API so you can see what it returned! - Get the track's
id
- Call
playTrack(id)
- BONUS: Update jumbotron
#songtitle
to display the song title - Fill out
playTrack()
- Make sure to keep track of the song you are playing by storing it in
currentSong
- Play the track for the given
id
* Hint: look atplayOneTrack()
for help
###4) Randomization: Make the random button work!
- Fill out the
moodList
array with 10 moods/emotions
- ex. 'happy', 'sad'
- Add
#random
button click handler - Fill out
randomClicked()
+randomMood()
###5) Bonus Challenges:
- Change the color of the jumbotron to match the user's mood!
- Add Bootstrap typeahead to the
#mood
input field - Find more fun stuff to do with the Soundcloud API!