Add Input playback
This commit is contained in:
parent
471d2c160b
commit
9c605da2f6
1 changed files with 91 additions and 69 deletions
|
|
@ -481,6 +481,19 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let InputPlayer = class extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return(
|
||||||
|
<textarea name="input" id="input" cols="30" rows="10" disabled>{this.props.input}</textarea>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
let Player = class extends React.Component {
|
let Player = class extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
@ -506,6 +519,7 @@
|
||||||
this.dragPanDisable = this.dragPanDisable.bind(this);
|
this.dragPanDisable = this.dragPanDisable.bind(this);
|
||||||
this.zoom = this.zoom.bind(this);
|
this.zoom = this.zoom.bind(this);
|
||||||
this.fastForwardToTS = this.fastForwardToTS.bind(this);
|
this.fastForwardToTS = this.fastForwardToTS.bind(this);
|
||||||
|
this.sendInput = this.sendInput.bind(this);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
cols: 80,
|
cols: 80,
|
||||||
|
|
@ -528,7 +542,8 @@
|
||||||
containerWidth: 630,
|
containerWidth: 630,
|
||||||
currentTsPost: 0,
|
currentTsPost: 0,
|
||||||
scale: 1,
|
scale: 1,
|
||||||
error: null
|
error: null,
|
||||||
|
input: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
this.containerHeight = 290;
|
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 */
|
/* Synchronize playback */
|
||||||
sync() {
|
sync() {
|
||||||
let locDelay;
|
let locDelay;
|
||||||
|
|
@ -697,11 +719,6 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip packets we don't output */
|
|
||||||
if (pkt.is_io && !pkt.is_output) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.pkt = pkt;
|
this.pkt = pkt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -749,7 +766,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output the packet */
|
/* 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);
|
this.state.term.write(this.pkt.io);
|
||||||
} else {
|
} else {
|
||||||
this.state.term.resize(this.pkt.width, this.pkt.height);
|
this.state.term.resize(this.pkt.width, this.pkt.height);
|
||||||
|
|
@ -995,6 +1014,7 @@
|
||||||
|
|
||||||
// ensure react never reuses this div by keying it with the terminal widget
|
// ensure react never reuses this div by keying it with the terminal widget
|
||||||
return (
|
return (
|
||||||
|
<div>
|
||||||
<div ref="wrapper" className="panel panel-default">
|
<div ref="wrapper" className="panel panel-default">
|
||||||
<div className="panel-heading">
|
<div className="panel-heading">
|
||||||
<span>{this.state.title}</span>
|
<span>{this.state.title}</span>
|
||||||
|
|
@ -1061,6 +1081,8 @@
|
||||||
</div>
|
</div>
|
||||||
{error}
|
{error}
|
||||||
</div>
|
</div>
|
||||||
|
<InputPlayer input={this.state.input} />
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue