Update vnc_playback.html to follow current API

We had tried to update this along the way, but a bunch of things
were overlooked. Should be fully functional again now.
This commit is contained in:
Pierre Ossman 2018-01-26 11:07:14 +01:00
parent 2a4e84ac20
commit a92c33174e
3 changed files with 9 additions and 11 deletions

View File

@ -115,7 +115,7 @@ IterationPlayer.prototype = {
this._nextIteration(); this._nextIteration();
}, },
_disconnected: function (rfb, clean, frame) { _disconnected: function (clean, frame) {
if (!clean) { if (!clean) {
this._state = 'failed'; this._state = 'failed';
} }
@ -123,6 +123,7 @@ IterationPlayer.prototype = {
var evt = new Event('rfbdisconnected'); var evt = new Event('rfbdisconnected');
evt.clean = clean; evt.clean = clean;
evt.frame = frame; evt.frame = frame;
evt.iteration = this._iteration;
this.onrfbdisconnected(evt); this.onrfbdisconnected(evt);
}, },
@ -149,7 +150,7 @@ function start() {
message(`Iteration ${evt.number} took ${evt.duration}ms`); message(`Iteration ${evt.number} took ${evt.duration}ms`);
}; };
player.onrfbdisconnected = function (evt) { player.onrfbdisconnected = function (evt) {
if (evt.reason) { if (!evt.clean) {
message(`noVNC sent disconnected during iteration ${evt.iteration} frame ${evt.frame}`); message(`noVNC sent disconnected during iteration ${evt.iteration} frame ${evt.frame}`);
} }
}; };

View File

@ -76,7 +76,7 @@ export default function RecordingPlayer (frames, encoding, disconnected) {
RecordingPlayer.prototype = { RecordingPlayer.prototype = {
run: function (realtime, trafficManagement) { run: function (realtime, trafficManagement) {
// initialize a new RFB // initialize a new RFB
this._rfb = new RFB(document.getElementById('VNC_canvas'), 'wss://test'); this._rfb = new RFB(document.getElementById('VNC_screen'), 'wss://test');
this._rfb.viewOnly = true; this._rfb.viewOnly = true;
this._rfb.addEventListener("disconnect", this._rfb.addEventListener("disconnect",
this._handleDisconnect.bind(this)); this._handleDisconnect.bind(this));
@ -99,9 +99,9 @@ RecordingPlayer.prototype = {
this._rfb._sock.send = function (arr) {}; this._rfb._sock.send = function (arr) {};
this._rfb._sock.close = function () {}; this._rfb._sock.close = function () {};
this._rfb._sock.flush = function () {}; this._rfb._sock.flush = function () {};
this._rfb._checkEvents = function () {}; this._rfb._sock.open = function () {
this._rfb._connect = function () { this.init();
this._sock.init('binary', 'ws'); this._eventHandlers.open();
}; };
}, },
@ -187,8 +187,8 @@ RecordingPlayer.prototype = {
} }
}, },
_handleDisconnect(rfb, clean) { _handleDisconnect(evt) {
this._running = false; this._running = false;
this._disconnected(rfb, clean, this._frame_index); this._disconnected(evt.detail.clean, this._frame_index);
} }
}; };

View File

@ -26,9 +26,6 @@
<td><div id="VNC_status">Loading</div></td> <td><div id="VNC_status">Loading</div></td>
</tr></table> </tr></table>
</div> </div>
<canvas id="VNC_canvas" width="640px" height="20px">
Canvas not supported.
</canvas>
</div> </div>
</body> </body>