mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
Add StreamDispatcher.time and totalStreamTime, addresses #674
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -50,6 +50,24 @@ class StreamDispatcher extends EventEmitter {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* how long the stream dispatcher has been "speaking" for
|
||||||
|
* @type {number}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get time() {
|
||||||
|
return this.streamingData.count * (this.streamingData.length || 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total time, taking into account pauses and skips, that the dispatcher has been streaming for.
|
||||||
|
* @type {number}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get totalStreamTime() {
|
||||||
|
return this.time + this.streamingData.pausedTime;
|
||||||
|
}
|
||||||
|
|
||||||
_createPacket(sequence, timestamp, buffer) {
|
_createPacket(sequence, timestamp, buffer) {
|
||||||
const packetBuffer = new Buffer(buffer.length + 28);
|
const packetBuffer = new Buffer(buffer.length + 28);
|
||||||
packetBuffer.fill(0);
|
packetBuffer.fill(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user