mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
Fixed voice_connection.stopPlaying
Now unpipes before destroying
This commit is contained in:
@@ -43,6 +43,10 @@ var _events = require("events");
|
||||
|
||||
var _events2 = _interopRequireDefault(_events);
|
||||
|
||||
var _unpipe = require("unpipe");
|
||||
|
||||
var _unpipe2 = _interopRequireDefault(_unpipe);
|
||||
|
||||
var VoiceConnection = (function (_EventEmitter) {
|
||||
_inherits(VoiceConnection, _EventEmitter);
|
||||
|
||||
@@ -91,13 +95,10 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
VoiceConnection.prototype.stopPlaying = function stopPlaying() {
|
||||
this.playing = false;
|
||||
this.playingIntent = null;
|
||||
if (this.streamProc) {
|
||||
this.streamProc.stdin.pause();
|
||||
this.streamProc.kill("SIGINT");
|
||||
}
|
||||
if (this.instream) {
|
||||
//not all streams implement these...
|
||||
//and even file stream don't seem to implement them properly...
|
||||
_unpipe2["default"](this.instream);
|
||||
if (this.instream.end) {
|
||||
this.instream.end();
|
||||
}
|
||||
@@ -106,6 +107,11 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
}
|
||||
this.instream = null;
|
||||
}
|
||||
if (this.streamProc) {
|
||||
this.streamProc.stdin.pause();
|
||||
this.streamProc.kill("SIGINT");
|
||||
this.streamProc = null;
|
||||
}
|
||||
};
|
||||
|
||||
VoiceConnection.prototype.playStream = function playStream(stream) {
|
||||
@@ -118,9 +124,6 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
|
||||
var length = 20;
|
||||
|
||||
if (self.playingIntent) {
|
||||
self.stopPlaying();
|
||||
}
|
||||
self.playing = true;
|
||||
var retStream = new _StreamIntent2["default"]();
|
||||
var onWarning = false;
|
||||
@@ -318,7 +321,6 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
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://" + _this4.endpoint, null, { rejectUnauthorized: false });
|
||||
_this4.endpoint = address;
|
||||
|
||||
Reference in New Issue
Block a user