My Music Playlist

https://my-song-playlist.glitch.me
Hi! Sooo…I made my first project on glitch, a music playlist!(FINALLY)!
I will be styling it with CSS soon, but this is how it works!
Thanks to @code-alt and @aboutDavid and everyone who showed me how to upload music to glitch!
I am going to add this project to my website, http://madeehasecretworld.weebly.com/ so i hope you all like it! (And I hope you enjoy my website, too. Tell me if you do)

I appreciate all feedback, including negative feedback, on this project.

3 Likes

it looks great! maybe u could make it only play one song at a time so you don’t have to reload to listen to a different song

2 Likes

Nice songs and

that should be 14. House of Memories (by Panic! At the Disco)

4 Likes

oh, lol, i’ll fix that.

what do you mean?

He means we wants to change songs without refreshing. When you try to change songs, you okay both songs at once. This is an example on how to fix that issue:

<script>window.player = new Audio();</script>
<button onclick="window.player.src = 'url/to/file.mp3';window.player.play()">Click to play song 1</button>
<button onclick="window.player.src = 'url/to/file.mp3';window.player.play()">Click to play song 2</button>
<button onclick="window.player.src = 'url/to/file.mp3';window.player.play()">Click to play song 3</button>
1 Like

oh, ok, thanks. @Remiix I’ll work on that when I get a chance.

1 Like

You should read about DRY, it means Don’t Repeat Yourself

you have a lot of repeated code, so it can get hard to maintain

2 Likes

actually that doesn’t seem to work. it makes the song not work at all. or maybe i’m doing something wrong?

Add that script tag to the top of the page.

<script>window.player = new Audio();</script>

That’s the part you forgot.

1 Like

i put that, but it still doesn’t work…

Ah, ok, I see the problem. Change window.play() to window.player.play(). My bad.

2 Likes

some of the songs won’t work, but i don’t see anything wrong with the code. how do i make code show up in a post so that you can see what I’m talking about?

add three backticks at the start of the code (```) and three at the end (```)

ok, so this is how it looks:
<li>Ah, It's a Wonderful Cat Life (by Kagamine Len and GUMI) <button onclick="window.player.src = 'https://cdn.glitch.com/d9558dfb-d117-4176-a30d-e519c37ee49d%2F%E3%80%90VOCALOID%E3%80%91%E3%80%8CAh%2C%20It's%20a%20Wonderful%20Cat%20Life%E3%80%8D%E3%80%90Len%20x%20GUMI%E3%80%91%5BENG%20SUB%5D.mp3?v=1606788799649'; window.player.play()">Click me to Listen!</button></li><br><br>

Can you upload the song without that ’

1 Like

Lol, my friend just showed me how to fix that 15 minutes ago. but thanks for your help. you’re just supposed to put a backwards slash before the apostrophe.

1 Like