Music is only playing if the loadType is search.. everything else is not working

This is my code atm: https://sourceb.in/OT8OoiXZF1
2 Replies
provincial-silver
provincial-silver•2y ago
loadType empty = nothing was found i.e. there is no music to be played loadType track or search = the search resulted in a specific song or several songs in the array format loadType playlist = the search resulted in a playlist I recommend going putting some console.log throughout the code to see if it is running up to the log part if after a certain log does not appear the next you found the location of the problem then just mess with the code improving it until it works
fair-rose
fair-roseOP•2y ago
okay thank you. Also do you know how to set the volume of the player when CREATING a new player? I am stupid I found the error... I had to modify this:
if (res.loadType === 'track') res = { tracks: [res.data[0]] };
if (res.loadType === 'playlist') res = { tracks: [res.data] };
if (res.loadType === 'track') res = { tracks: [res.data[0]] };
if (res.loadType === 'playlist') res = { tracks: [res.data] };
to
if (res.loadType === 'track') res = { loadType: 'track', tracks: [res.data[0]] };
if (res.loadType === 'playlist') res = { loadType: 'playlist', tracks: [res.data] }
if (res.loadType === 'track') res = { loadType: 'track', tracks: [res.data[0]] };
if (res.loadType === 'playlist') res = { loadType: 'playlist', tracks: [res.data] }

Did you find this page helpful?