From 9c605da2f63f327c663bacba6d28def10d370480 Mon Sep 17 00:00:00 2001 From: Kyrylo Gliebov Date: Thu, 26 Jul 2018 14:47:30 +0200 Subject: [PATCH] Add Input playback --- src/player.jsx | 160 ++++++++++++++++++++++++++++--------------------- 1 file changed, 91 insertions(+), 69 deletions(-) diff --git a/src/player.jsx b/src/player.jsx index 128228d..929ab5d 100644 --- a/src/player.jsx +++ b/src/player.jsx @@ -481,6 +481,19 @@ } }; + let InputPlayer = class extends React.Component { + constructor(props) { + super(props); + } + + render() { + return( + + ); + } + + }; + let Player = class extends React.Component { constructor(props) { super(props); @@ -506,6 +519,7 @@ this.dragPanDisable = this.dragPanDisable.bind(this); this.zoom = this.zoom.bind(this); this.fastForwardToTS = this.fastForwardToTS.bind(this); + this.sendInput = this.sendInput.bind(this); this.state = { cols: 80, @@ -528,7 +542,8 @@ containerWidth: 630, currentTsPost: 0, scale: 1, - error: null + error: null, + input: "" }; this.containerHeight = 290; @@ -670,6 +685,13 @@ }); } + sendInput(pkt) { + if (pkt) { + const current_input = this.state.input; + this.setState({input: current_input + pkt.io}); + } + } + /* Synchronize playback */ sync() { let locDelay; @@ -697,11 +719,6 @@ return; } - /* Skip packets we don't output */ - if (pkt.is_io && !pkt.is_output) { - continue; - } - this.pkt = pkt; } @@ -749,7 +766,9 @@ } /* Output the packet */ - if (this.pkt.is_io) { + if (this.pkt.is_io && !this.pkt.is_output) { + this.sendInput(this.pkt); + } else if (this.pkt.is_io) { this.state.term.write(this.pkt.io); } else { this.state.term.resize(this.pkt.width, this.pkt.height); @@ -995,71 +1014,74 @@ // ensure react never reuses this div by keying it with the terminal widget return ( -
-
- {this.state.title} -
-
-
-
+
+
+
+ {this.state.title}
-
-
-