Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Object-Oriented JavaScript (2015) Constructor Functions and Prototypes Making the UI Work

Daniel Hildreth
Daniel Hildreth
16,170 Points

Object-Orientated-JavaScript How to get the playlist to play actual songs.

So I just finished up Making the UI work with the playlist in the Object Orientated JavaScript course. Now I know we don't actually go over on how to play the actual songs, but if I wanted to implement this into my coding, how could I do that?

2 Answers

Trevor Austin
Trevor Austin
8,153 Points

I found this: http://stackoverflow.com/questions/9419263/playing-audio-with-javascript when I googled "play sound javascript"

var audio = new Audio('audio_file.mp3');
audio.play();
Daniel Hildreth
Daniel Hildreth
16,170 Points

But I'm trying to use the playlist we created in the course with Andrew Chalkley in order to play the songs. It's in a playlist with buttons and all, and I added the songs into it but can't get it to play.