Keep trying to load video until it's available (temporary)
This commit is contained in:
parent
bcb7bc373b
commit
4924b8d272
1 changed files with 11 additions and 1 deletions
|
@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue