Make 15 sec fallback loop start when video is created, loop properly

This commit is contained in:
Alex Liebowitz 2016-05-11 03:17:42 -04:00
parent 5870f42ab3
commit d3745e13d1

View file

@ -18,14 +18,13 @@ var WatchPage = React.createClass({
componentDidMount: function() { componentDidMount: function() {
lbry.getStream(this.props.name); lbry.getStream(this.props.name);
this.updateLoadStatus(); this.updateLoadStatus();
setTimeout(() => { this.reloadIfNeeded() }, 15000);
}, },
reloadIfNeeded: function() { reloadIfNeeded: function() {
// Fallback option for loading problems: every 15 seconds, if the video hasn't reported being // Fallback option for loading problems: every 15 seconds, if the video hasn't reported being
// playable yet, ask it to reload. // playable yet, ask it to reload.
if (!this.state.readyToPlay) { if (!this.state.readyToPlay) {
console.log("Trying again");
this._video.load() this._video.load()
setTimeout(() => { this.reloadIfNeeded() }, 15000);
} }
}, },
onCanPlay: function() { onCanPlay: function() {