Added play command and streaming
This commit is contained in:
parent
eb365a2ab2
commit
f1fa1a913a
16
app.js
16
app.js
|
@ -13,20 +13,30 @@ mumble.connect('mumble://wallpiece:9648', function( error, client ) {
|
||||||
});
|
});
|
||||||
|
|
||||||
var start = function( client ) {
|
var start = function( client ) {
|
||||||
// client.outputStream().pipe(client.inputStream());
|
|
||||||
var input = client.inputStream();
|
var input = client.inputStream();
|
||||||
var decoder = new lame.Decoder();
|
var decoder = new lame.Decoder();
|
||||||
|
|
||||||
|
client.channelByName('Gaming').join()
|
||||||
|
|
||||||
|
client.on('textMessage', function (data) {
|
||||||
|
// console.log(client.userBySession(data.session[0]));
|
||||||
|
if (data.message == 'play') {
|
||||||
var stream;
|
var stream;
|
||||||
decoder.on( 'format', function( format ) {
|
decoder.on( 'format', function( format ) {
|
||||||
console.log( format );
|
// console.log( format );
|
||||||
|
|
||||||
stream.pipe( client.inputStream({
|
stream.pipe( client.inputStream({
|
||||||
channels: format.channels,
|
channels: format.channels,
|
||||||
sampleRate: format.sampleRate,
|
sampleRate: format.sampleRate,
|
||||||
gain: 1
|
gain: 0.1
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
stream = require('fs').createReadStream(__dirname + '/test.mp3').pipe( decoder );
|
stream = require('fs').createReadStream(__dirname + '/test.mp3').pipe( decoder );
|
||||||
|
}
|
||||||
|
client.channelByName('Gaming').join()
|
||||||
|
// if (data.)
|
||||||
|
// client.sendMessage('Received message');
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue