-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
requesting playerState #82
Comments
When you join ( |
Hey @pedromsilvapt, thanks for answer!
Can I call |
Although I am not super familiar with the module's inner workings, a quick look through the code does indeed reveal that every request creates a new listener here: But I gotta say, I've used it before like that (calling One possible solution that I see is: it creates a event listener for every request, and removes it when the response comes. However, let's say that for whatever reason it is taking a long time to respond (it happens sometimes on my chromecasts). ``setInterval` has a fixed interval, which means, it does not wait for it's code to finish before triggering again. Let's say your interval is of 2 seconds, and the requests are taking a long time, every two seconds will add another listener, without removing the ones before. Obviously this is just a theory, and I can't know for sure without seeing your code, but if the case above applies to you, maybe try increasing the setInterval, or use a setTimeout instead, and recreate it only once the last one finishes. |
Just realized that I'm getting this error when Backdrop is active on Chromecast. It never happens when Spotify is an active app. |
Well, probably the backdrop app does not answer to the status request, hence the memory leak on the event emitter. You can listen to the |
What I did in my application is to call example: if (session.namespaces.find(n => n.name === "urn:x-cast:com.google.cast.media")) {
player.getStatus();
} else {
throw new Error("There is no active media session");
} |
I know I can get
playerState
on various player events like play, pause or track change.How can i get
playerState
(f.e. PLAYING) without waiting for such event?client.getStatus()
returns active app but there is noplayerState
.The text was updated successfully, but these errors were encountered: