Keep trying to load video until it's available (temporary)

This commit is contained in:
Alex Liebowitz 2016-04-22 06:29:13 -04:00
parent bcb7bc373b
commit 4924b8d272

View file

@ -8,10 +8,20 @@ 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} controls></video> <video style={videoStyle} src={"/view?name=" + this.props.name} ref={this.updateVideo} controls></video>
</main> </main>
); );
} }