Add StreamDispatcher.time and totalStreamTime, addresses #674

This commit is contained in:
Amish Shah
2016-09-10 14:44:46 +01:00
parent 9d1d7c5162
commit 8c0685fa9a
2 changed files with 19 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -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);