Darren-project / obsidian-spotify

Spotify api in obsidian
Other
12 stars 3 forks source link

item is null on player.getPlaybackState() when currently_playing_type is "episode" #5

Closed ghost closed 5 months ago

ghost commented 6 months ago

I'm trying to execute this on console:

const searchResults = await window.spotifysdk.player.getPlaybackState();
console.log(searchResults);

But the item property on the returning object is null when I am listening to a podcast (currently_playing_type == "episode"). When I am listening to a song, it works just fine. Can the information about podcasts be added?

mickeydarrenlau commented 5 months ago

Its raw spotify sdk not me who controls it here's some example anyway sorry for not replying due to school

data = await spotifysdk.player.getPlaybackState("ES","track,episode")
if(data.currently_playing_type == "episode"){
        songname.innerText = "Currently playing " + data.item.name + " from " + data.item.show.name + " by " + data.item.show.publisher
        window.spotify.media.currentchangingsliders = false
        image[0].src = data.item.images[1].url

    } else {
        songname.innerText = "Currently playing " + data.item.name + " from " + data.item.album.name + " by " + artistname.slice(0, -2)
        window.spotify.media.currentchangingsliders = false
        image[0].src = data.item.album.images[1].url
    }
mickeydarrenlau commented 5 months ago

also here's the spotify sdk docs tell me when you have received this message and understood it

mickeydarrenlau commented 5 months ago

@turing-ex-machina

ghost commented 5 months ago

Sorry, I'm no longer using this plugin. I'm now using the Spotify Link plugin, which is working better for my use case. Gonna close the issue. Thanks for the support!