diff --git a/src/renderer/controllers/playback-controller.js b/src/renderer/controllers/playback-controller.js index bd517e86..176ae6a4 100644 --- a/src/renderer/controllers/playback-controller.js +++ b/src/renderer/controllers/playback-controller.js @@ -4,8 +4,7 @@ const path = require('path') const Cast = require('../lib/cast') const {dispatch} = require('../lib/dispatcher') const telemetry = require('../lib/telemetry') -const {UnplayableFileError, UnplayableTorrentError, - PlaybackTimedOutError} = require('../lib/errors') +const {UnplayableFileError, UnplayableTorrentError} = require('../lib/errors') const sound = require('../lib/sound') const TorrentPlayer = require('../lib/torrent-player') const TorrentSummary = require('../lib/torrent-summary') @@ -223,34 +222,11 @@ module.exports = class PlaybackController { state.playing.infoHash = torrentSummary.infoHash // update UI to show pending playback - if (torrentSummary.progress !== 1) sound.play('PLAY') - // TODO: remove torrentSummary.playStatus - torrentSummary.playStatus = 'requested' - this.update() + sound.play('PLAY') - const timeout = setTimeout(() => { - telemetry.logPlayAttempt('timeout') - // TODO: remove torrentSummary.playStatus - torrentSummary.playStatus = 'timeout' /* no seeders available? */ - sound.play('ERROR') - cb(new PlaybackTimedOutError()) - this.update() - }, 10000) /* give it a few seconds */ - - this.startServer(torrentSummary, () => { - clearTimeout(timeout) - - // if we timed out (user clicked play a long time ago), don't autoplay - const timedOut = torrentSummary.playStatus === 'timeout' - delete torrentSummary.playStatus - if (timedOut) { - ipcRenderer.send('wt-stop-server') - return this.update() - } - - ipcRenderer.send('onPlayerOpen') - this.updatePlayer(infoHash, index, true, cb) - }) + this.startServer(torrentSummary) + ipcRenderer.send('onPlayerOpen') + this.updatePlayer(infoHash, index, true, cb) } // Starts WebTorrent server for media streaming @@ -265,7 +241,6 @@ module.exports = class PlaybackController { function onTorrentReady () { ipcRenderer.send('wt-start-server', torrentSummary.infoHash) - ipcRenderer.once('wt-server-' + torrentSummary.infoHash, () => cb()) } } diff --git a/src/renderer/lib/state.js b/src/renderer/lib/state.js index 39758bdb..bac5a7e3 100644 --- a/src/renderer/lib/state.js +++ b/src/renderer/lib/state.js @@ -215,9 +215,6 @@ function saveImmediate (state, cb) { if (key === 'progress' || key === 'torrentKey') { continue // Don't save progress info or key for the webtorrent process } - if (key === 'playStatus') { - continue // Don't save whether a torrent is playing / pending - } if (key === 'error') { continue // Don't save error states } diff --git a/src/renderer/pages/torrent-list-page.js b/src/renderer/pages/torrent-list-page.js index 81d871a3..c108eb7f 100644 --- a/src/renderer/pages/torrent-list-page.js +++ b/src/renderer/pages/torrent-list-page.js @@ -56,8 +56,6 @@ module.exports = class TorrentList extends React.Component { // Foreground: name of the torrent, basic info like size, play button, // cast buttons if available, and delete const classes = ['torrent'] - // playStatus turns the play button into a loading spinner or error icon - if (torrentSummary.playStatus) classes.push(torrentSummary.playStatus) if (isSelected) classes.push('selected') if (!infoHash) classes.push('disabled') if (!torrentSummary.torrentKey) throw new InvalidTorrentError('Missing torrentKey') @@ -197,25 +195,16 @@ module.exports = class TorrentList extends React.Component { renderTorrentButtons (torrentSummary) { const infoHash = torrentSummary.infoHash - let playIcon, playTooltip - if (torrentSummary.playStatus === 'timeout') { - playIcon = 'warning' - playTooltip = 'Playback timed out. No seeds? No internet? Click to try again.' - } else { - playIcon = 'play_circle_outline' - playTooltip = 'Start streaming' - } - // Only show the play/dowload buttons for torrents that contain playable media let playButton if (!torrentSummary.error && TorrentPlayer.isPlayableTorrentSummary(torrentSummary)) { playButton = ( - {playIcon} + play_circle_outline ) }