Open Jack-Drake opened 5 years ago
according to this issue, devise like Google Home volume control function has node-castv2-client library.
if you want to set volume, you put setVolume method in client.connect() callback please see https://gist.github.com/guerrerocarlos/552cdb38cbd8d153260e#file-castv2-client-test1-js-L56
import {
Client as GoogleCastClient,
DefaultMediaReceiver,
} from 'castv2-client';
const ip = '192.168.10.55'; // change this
const client = new GoogleCastClient();
client.connect(
ip,
() => {
client.launch(DefaultMediaReceiver, (err, player) => {
const media = {
contentId: url,
contentType: 'audio/mp3',
streamType: 'BUFFERED',
};
setTimeout(() => {
client.setvolume(0.5, (err, newVolume) => {
if(err) {
console.log("there was an error.");
client.close();
return;
}
console.log(`volume changed to ${newVolume}`);
})
client.close();
}
, 10000);
});
},
);
Thank you to understand my poor English m( )m
In my opinion, you fork this or you use patch-package library and modify this part
google tts has no volume option please see https://github.com/zlargon/google-tts/issues/18
How do I raise and lower the volume in the options?