I’m building a custom application that works with Spotify’s API. Users need to pick between searching their personal music collection or the main Spotify catalog.
I want to find specific musicians or music styles in both the user’s saved music and Spotify’s full database. Here’s what I tried:
var musicQuery = new models.Search("eminem");
musicQuery.localResults = models.LOCALSEARCHRESULTS.APPEND;
musicQuery.observe(models.EVENT.CHANGE, function() {
musicQuery.artists.forEach(function(musician) {
console.log(musician.name);
});
});
musicQuery.appendNext();
But I keep getting these errors:
Uncaught TypeError: Cannot read property ‘APPEND’ of undefined
Uncaught TypeError: Object has no method ‘observe’
Does anyone know the right way to search through both the user’s saved tracks and Spotify’s main catalog? Do I need to use a different library to make this work? Any suggestions for external tools that can handle this kind of music search functionality would be really helpful.