Skip to content

Commit

Permalink
fix: avoid try render from torrent progress after component did unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
geolffreym committed Mar 30, 2021
1 parent 13b2d24 commit a2d8bac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/core/torrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module.exports = class TorrentStreamer extends EventEmitter {
let state = 'Connecting';

// There's a minimum size before we start playing the video.
if (this.stopped) return; // Avoid keep loading timeout
const targetLoadedSize = MIN_SIZE_LOADED > total ? total : MIN_SIZE_LOADED;
const targetLoadedPercent = MIN_PERCENTAGE_LOADED * total / 100.0;
const targetLoaded = Math.max(targetLoadedPercent, targetLoadedSize);
Expand Down Expand Up @@ -171,7 +172,7 @@ module.exports = class TorrentStreamer extends EventEmitter {
this.flix.href = 'http://127.0.0.1:' + this.flix.server.address().port + '/';

//Clear old timeout
this.loadedTimeout ? clearTimeout(this.loadedTimeout) : null;
this.loadedTimeout && clearTimeout(this.loadedTimeout);
this.checkLoadingProgress(this.flix);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class AppMoviesPlayerTorrent extends React.PureComponent {
<>
{
(
!this.state.canPlay && !this.state.flix &&
!this.state.canPlay &&
<div className="absolute full-width full-height player-overlay-loader">
<AppMoviePlayerLoader
stateText={this.state.state}
Expand Down

0 comments on commit a2d8bac

Please sign in to comment.