mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 21:12:06 +00:00
Add StreamDispatcher.time and totalStreamTime, addresses #674
This commit is contained in:
parent
9d1d7c5162
commit
8c0685fa9a
2 changed files with 19 additions and 1 deletions
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) {
|
||||
const packetBuffer = new Buffer(buffer.length + 28);
|
||||
packetBuffer.fill(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue