discord.js/src/client/voice/player/DefaultPlayer.js
Schuyler Cebulskie 8f9923976f Fix stuff
2016-09-09 11:35:59 -04:00

19 lines
595 B
JavaScript

const BasePlayer = require('./BasePlayer');
const fs = require('fs');
class DefaultPlayer extends BasePlayer {
playFile(file, { seek = 0, volume = 1 } = {}) {
const options = { seek: seek, volume: volume };
return this.playStream(fs.createReadStream(file), options);
}
playStream(stream, { seek = 0, volume = 1 } = {}) {
this._shutdown();
const options = { seek: seek, volume: volume };
const pcmStream = this.convertStream(stream, options);
const dispatcher = this.playPCMStream(pcmStream, options);
return dispatcher;
}
}
module.exports = DefaultPlayer;