Skip to content
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

How would I set the volume on a chromecast audio? #72

Open
dk253 opened this issue Jul 10, 2017 · 1 comment
Open

How would I set the volume on a chromecast audio? #72

dk253 opened this issue Jul 10, 2017 · 1 comment

Comments

@dk253
Copy link

dk253 commented Jul 10, 2017

Hey, Thanks for the library!
I'm trying to set the volume on a Chromecast Audio. Actually I'm trying to write a web app to control all the volumes on all of the chromecasts at once. How would I use your lib to do that?

Thanks!

@jonferreira
Copy link

if(typeof volume !== 'undefined') {
		  
			if(volume > 0){
				var obj = { level: volume/100 };
			} else {
				var obj = { muted: true };
			}
			
			  client.setVolume(obj, function(err, newvol){
				if(err) {
					console.log("there was an error setting the volume")
					node.error("Chromecast error: there was an error setting the volume");
					msg.error = "there was an error setting the volume";
					node.send(msg);
					return node.status({
					  shape: "dot",
					  fill: "red",
					  text: "error: there was an error setting the volume" 
					});
				}
				console.log("volume changed to %s", Math.round(newvol.level * 100))
			});
				
		  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants