Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9
https://code.sololearn.com/WgppELogkUYK/#js not perfect... would like to press play automatically
16th Jun 2019, 3:36 PM
Oma Falk
Oma Falk - avatar
+ 7
Jax maybe that slow prevents u from hearing two songs simultaneously.
17th Jun 2019, 11:25 AM
Oma Falk
Oma Falk - avatar
+ 5
Because you set the song url at line 73 const track = new Audio(songs[id].url) once only when creating the app. you need to use {{songs[id].url}} as attribute of Controls component to make it updated; alternatively, try updating track in prev() and next() here is a fix for your reference, in case you couldn't work out. https://code.sololearn.com/Wh5Uu2VSa2n6/?ref=app also, the prev and next button can't call setPlaying which belongs to Control, perhaps disable them if not paused.
16th Jun 2019, 10:42 AM
Gordon
Gordon - avatar
+ 4
Maybe
17th Jun 2019, 9:13 AM
Enzo Letona
Enzo Letona - avatar
+ 3
hmmm, that's strange. the play button and the prev next buttons all look normal on my device. before playing the song, i can use next button to change song, and then the src is changed, so then pressing play button will play the newly chosen song. my edition are at my line 75 79 80 84 85. you can add track.play() after src change.
16th Jun 2019, 2:00 PM
Gordon
Gordon - avatar