Closed IZeeLikeEyeZee closed 1 year ago
Creating the fake device takes around a second or two, and this is unavoidable - however executing any commands after creating the SpotifyPlayer should be sub-second. If you're making a program that will change the playback state over a long duration of time, you should just use the same SpotifyPlayer instance, to avoid the overhead of creating a new device.
Sorry I don't really know how to code, how could I use the same SpotifyPlayer instance instead of creating a new device?
Just use the same variable assigned to the SpotifyPlayer instance. Creating the fake device is done by initializing the SpotifyPlayer (line 1), and any commands do not need to create a new fake device, they just use the same device that was instantiated.
spotifyplayer = SpotifyPlayer() # 1-2 secs
spotifyplayer.command(spotifyplayer.pause) # < 0.5 secs
# some long operation here
time.sleep(10)
spotifyplayer.command(spotifyplayer.resume) # < 0.5 secs
Creating the fake device at the beginning is unavoidable, so the start of the program is bound to have 1-2 seconds of overhead, but each command after should be sub 0.5 seconds.
There is a noticeable delay between running the script and the script actually affecting spotify (~1s), is there any way to reduce that? It seems like initializing the fake device or whatever might be the main cause of that, so maybe there's a way to keep it initialized in the background?
Idrk what I'm talking about though so if it's possible to make it more instant that would be great 😄