encoding = VNC_frame_encoding;
}
-const notification = function (rfb, mesg, level, options) {
- document.getElementById('VNC_status').textContent = mesg;
-}
-
function IterationPlayer (iterations, frames, encoding) {
this._iterations = iterations;
this.onfinish = function() {};
this.oniterationfinish = function() {};
this.rfbdisconnected = function() {};
- this.rfbnotification = function() {};
}
IterationPlayer.prototype = {
},
_nextIteration: function () {
- const player = new RecordingPlayer(this._frames, this._encoding, this._disconnected.bind(this), this._notification.bind(this));
+ const player = new RecordingPlayer(this._frames, this._encoding, this._disconnected.bind(this));
player.onfinish = this._iterationFinish.bind(this);
if (this._state !== 'running') { return; }
this._nextIteration();
},
- _disconnected: function (rfb, reason, frame) {
- if (reason) {
+ _disconnected: function (rfb, clean, frame) {
+ if (!clean) {
this._state = 'failed';
}
var evt = new Event('rfbdisconnected');
- evt.reason = reason;
+ evt.clean = clean;
evt.frame = frame;
this.onrfbdisconnected(evt);
},
-
- _notification: function (rfb, msg, level, options) {
- var evt = new Event('rfbnotification');
- evt.message = msg;
- evt.level = level;
- evt.options = options;
-
- this.onrfbnotification(evt);
- },
};
function start() {
message(`noVNC sent disconnected during iteration ${evt.iteration} frame ${evt.frame}`);
}
};
- player.onrfbnotification = function (evt) {
- document.getElementById('VNC_status').textContent = evt.message;
- };
player.onfinish = function (evt) {
const iterTime = parseInt(evt.duration / evt.iterations, 10);
message(`${evt.iterations} iterations took ${evt.duration}ms (average ${iterTime}ms / iteration)`);
player.start(mode);
}
-loadFile().then(enableUI).catch(function (e) { message("Error loading recording"); });
+loadFile().then(enableUI).catch(function (e) { message("Error loading recording: " + e); });