augnitorecorder
Advanced tools
Comparing version 1.0.20 to 1.0.21
@@ -527,5 +527,11 @@ function _regeneratorRuntime() { | ||
var packetId = 0; | ||
var shouldNotReconnect = false; | ||
var JobID = ""; | ||
function initConnect() { | ||
lastConnect = +new Date(); | ||
ws = new WebSocket(wsUrl); | ||
if (JobID != "") { | ||
ws = new WebSocket(wsUrl + "&jobid=" + JobID); | ||
} else { | ||
ws = new WebSocket(wsUrl); | ||
} | ||
ws.onopen = function (event) { | ||
@@ -577,3 +583,3 @@ if (enableLogs) { | ||
} | ||
if (+new Date() - lastConnect > connectionRetryTimeout) { | ||
if (+new Date() - lastConnect > connectionRetryTimeout && !shouldNotReconnect) { | ||
initConnect(); | ||
@@ -601,2 +607,6 @@ } | ||
if (data.Type == "meta") { | ||
if (data.JobID) { | ||
JobID = data.JobID; | ||
console.log("JobID:", JobID); | ||
} | ||
self.postMessage({ | ||
@@ -606,2 +616,8 @@ type: "meta", | ||
}); | ||
var metaResponse = JSON.parse(message.data); | ||
if (metaResponse.Event && metaResponse.Event["Type"] === "INVALID_AUTH_CREDENTIALS") { | ||
shouldNotReconnect = true; | ||
} else { | ||
shouldNotReconnect = false; | ||
} | ||
} else if (data.Result && data.Result.Final) { | ||
@@ -626,2 +642,3 @@ // should not be called with "this", check worker construction for more info. | ||
} else if (data.Type == "ACK") { | ||
//reset queue with only those packets whose seq num is greater than ACK index | ||
sentPacketsQueue = sentPacketsQueue.filter(function (x) { | ||
@@ -634,2 +651,7 @@ return x.packetNumber > data.Index; | ||
}); | ||
} else if (data.Type == "ERROR") { | ||
self.postMessage({ | ||
type: "error", | ||
data: message.data | ||
}); | ||
} | ||
@@ -695,2 +717,3 @@ } | ||
add(eosMessage); | ||
JobID = ""; | ||
if (enableLogs) { | ||
@@ -1007,2 +1030,3 @@ console.log("Worker received DONE, time to terminate..."); | ||
var _StopStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() { | ||
var _this$processorNode; | ||
return _regeneratorRuntime().wrap(function _callee8$(_context8) { | ||
@@ -1023,3 +1047,3 @@ while (1) switch (_context8.prev = _context8.next) { | ||
// message sent to worklet-thread | ||
this.processorNode.port.postMessage(STOP_MSG); | ||
(_this$processorNode = this.processorNode) === null || _this$processorNode === void 0 || (_this$processorNode = _this$processorNode.port) === null || _this$processorNode === void 0 || _this$processorNode.postMessage(STOP_MSG); | ||
case 7: | ||
@@ -1151,3 +1175,3 @@ case "end": | ||
if (!this.streamer) { | ||
this.initialiseStreamer(); | ||
this.startAudio(); | ||
} else { | ||
@@ -1165,3 +1189,3 @@ if (this.streamer.IsPaused) { | ||
if (!this.streamer) { | ||
this.initialiseStreamer(); | ||
this.startAudio(); | ||
} else { | ||
@@ -1174,5 +1198,3 @@ this.stopAudio(); | ||
value: function startAudio() { | ||
if (!this.streamer) { | ||
this.initialiseStreamer(); | ||
} | ||
this.initialiseStreamer(); | ||
this.streamer.StartStream(); | ||
@@ -1196,3 +1218,4 @@ this.log("Stream Started..."); | ||
value: function stopAudio() { | ||
this.streamer.StopStream(); | ||
var _this$streamer; | ||
(_this$streamer = this.streamer) === null || _this$streamer === void 0 || _this$streamer.StopStream(); | ||
this.streamer = null; | ||
@@ -1222,6 +1245,2 @@ this.log("Stream Stopped..."); | ||
value: function onSessionEventCallback(data) { | ||
var meta = JSON.parse(data); | ||
if (meta.Event.Type === "SESSION_CREATED") { | ||
if (this.streamer && !this.streamer.IsStreaming) this.startAudio(); | ||
} | ||
if (this.onSessionEvent) { | ||
@@ -1228,0 +1247,0 @@ this.onSessionEvent(data); |
{ | ||
"name": "augnitorecorder", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"description": "Audio recorder and streamer compatible with any browser", | ||
@@ -5,0 +5,0 @@ "main": "dist/augnitoRecorder.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123074
1315