Remove video ready state poll (video now starts on first try)

This commit is contained in:
Alex Liebowitz 2016-04-27 01:28:45 -04:00
parent 54a125673e
commit b9d30cf85e

View file

@ -8,20 +8,11 @@ var WatchPage = React.createClass({
propTypes: { propTypes: {
name: React.PropTypes.string, name: React.PropTypes.string,
}, },
updateVideo: function(video, firstRun=true) {
if (!video.readyState) {
if (!firstRun) { // On the first run, give the browser's initial load a chance to work
video.load();
}
setTimeout(() => {
this.updateVideo(video, false);
}, 3000);
}
},
render: function() { render: function() {
return ( return (
<main> <main>
<video style={videoStyle} src={"/view?name=" + this.props.name} ref={this.updateVideo} controls></video> <video style={videoStyle} src={"/view?name=" + this.props.name} controls />
</main> </main>
); );
} }