mirror of
https://github.com/lewismoten/data-over-audio.git
synced 2026-04-20 13:16:23 +08:00
recover stream before timeout
This commit is contained in:
7
index.js
7
index.js
@@ -478,6 +478,12 @@ function collectSample() {
|
|||||||
|
|
||||||
// proposed end
|
// proposed end
|
||||||
data.streamEnded = priorStreamEnded;
|
data.streamEnded = priorStreamEnded;
|
||||||
|
} else {
|
||||||
|
if(pauseTimeoutId) {
|
||||||
|
window.clearTimeout(pauseTimeoutId);
|
||||||
|
pauseTimeoutId = undefined;
|
||||||
|
// recover prior bit stream
|
||||||
|
data.streamStarted = LAST_STREAM_STARTED;
|
||||||
} else {
|
} else {
|
||||||
// new bit stream
|
// new bit stream
|
||||||
data.streamStarted = time;
|
data.streamStarted = time;
|
||||||
@@ -486,6 +492,7 @@ function collectSample() {
|
|||||||
packetReceivedBits.length = 0;
|
packetReceivedBits.length = 0;
|
||||||
packetDataByteCount = 0;
|
packetDataByteCount = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// number of bit in the stream
|
// number of bit in the stream
|
||||||
const segmentIndex = data.segmentIndex = Math.floor((time - data.streamStarted) / SEGMENT_DURATION);
|
const segmentIndex = data.segmentIndex = Math.floor((time - data.streamStarted) / SEGMENT_DURATION);
|
||||||
|
|||||||
Reference in New Issue
Block a user