mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 13:02:38 +00:00
19 lines
595 B
JavaScript
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;
|