videomail-client 2.18.6 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -995,6 +995,8 @@ const Recorder = function (visuals, replay, defaultOptions = {}) {
995
995
 
996
996
  ctx.drawImage(userMedia.getRawVisuals(), 0, 0, canvas.width, canvas.height)
997
997
 
998
+ const nanoseconds = Math.round(window.performance.now() * 1000000)
999
+
998
1000
  recordingBuffer = frame.toBuffer()
999
1001
  recordingBufferLength = recordingBuffer.length
1000
1002
 
@@ -1004,7 +1006,12 @@ const Recorder = function (visuals, replay, defaultOptions = {}) {
1004
1006
 
1005
1007
  bytesSum += recordingBufferLength
1006
1008
 
1007
- writeStream(recordingBuffer, {
1009
+ const timeControlBuffer = Buffer.from(
1010
+ stringify({ frameNumber: framesCount, timestamp: nanoseconds })
1011
+ )
1012
+ const frameBuffer = Buffer.concat([recordingBuffer, timeControlBuffer])
1013
+
1014
+ writeStream(frameBuffer, {
1008
1015
  frameNumber: framesCount,
1009
1016
  onFlushedCallback: onFlushed
1010
1017
  })