mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 17:43:30 +01:00
Lib output for arbitrary ffmpeg playback
This commit is contained in:
@@ -285,14 +285,43 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
});
|
||||
};
|
||||
|
||||
VoiceConnection.prototype.init = function init() {
|
||||
VoiceConnection.prototype.playArbitraryFFmpeg = function playArbitraryFFmpeg(ffmpegOptions) {
|
||||
var _this3 = this;
|
||||
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function (err, str) {} : arguments[1];
|
||||
|
||||
var self = this;
|
||||
self.stopPlaying();
|
||||
if (typeof options === "function") {
|
||||
// options is the callback
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
return new Promise(function (resolve, reject) {
|
||||
_this3.encoder.encodeArbitraryFFmpeg(ffmpegOptions)["catch"](error).then(function (data) {
|
||||
self.streamProc = data.proc;
|
||||
self.instream = data.instream;
|
||||
var intent = self.playStream(data.stream);
|
||||
resolve(intent);
|
||||
callback(null, intent);
|
||||
});
|
||||
function error() {
|
||||
var e = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
|
||||
|
||||
reject(e);
|
||||
callback(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
VoiceConnection.prototype.init = function init() {
|
||||
var _this4 = this;
|
||||
|
||||
var self = this;
|
||||
console.log("\n\nendpoint:", this.endpoint, "\n\n");
|
||||
_dns2["default"].lookup(this.endpoint, function (err, address, family) {
|
||||
var vWS = self.vWS = new _ws2["default"]("wss://" + _this3.endpoint, null, { rejectUnauthorized: false });
|
||||
_this3.endpoint = address;
|
||||
var vWS = self.vWS = new _ws2["default"]("wss://" + _this4.endpoint, null, { rejectUnauthorized: false });
|
||||
_this4.endpoint = address;
|
||||
var udpClient = self.udp = _dgram2["default"].createSocket("udp4");
|
||||
|
||||
var firstPacket = true;
|
||||
|
||||
Reference in New Issue
Block a user