include/playback.js: support binary (non-base64) data files.
Data files should now set the variable VNC_frame_encoding to either "binary" or "base64". The python websockify recording mode adds this automatically based on what is negotiated with the client being recorded.
This commit is contained in:
parent
49578da448
commit
e7e6660272
|
@ -79,10 +79,22 @@ queue_next_packet = function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var bytes_processed = 0;
|
||||||
|
|
||||||
do_packet = function () {
|
do_packet = function () {
|
||||||
//Util.Debug("Processing frame: " + frame_idx);
|
//Util.Debug("Processing frame: " + frame_idx);
|
||||||
var frame = VNC_frame_data[frame_idx];
|
var frame = VNC_frame_data[frame_idx],
|
||||||
rfb.recv_message({'data' : frame.slice(frame.indexOf('{', 1) + 1)});
|
start = frame.indexOf('{', 1) + 1;
|
||||||
|
bytes_processed += frame.length - start;
|
||||||
|
if (VNC_frame_encoding === 'binary') {
|
||||||
|
var u8 = new Uint8Array(frame.length - start);
|
||||||
|
for (var i = 0; i < frame.length - start; i++) {
|
||||||
|
u8[i] = frame.charCodeAt(start + i);
|
||||||
|
}
|
||||||
|
rfb.recv_message({'data' : u8});
|
||||||
|
} else {
|
||||||
|
rfb.recv_message({'data' : frame.slice(start)});
|
||||||
|
}
|
||||||
frame_idx += 1;
|
frame_idx += 1;
|
||||||
|
|
||||||
queue_next_packet();
|
queue_next_packet();
|
||||||
|
|
Loading…
Reference in New Issue