Fix playback bug: ensure openPlayer() always calls its callback
This commit is contained in:
@@ -761,8 +761,8 @@ function openPlayer (infoHash, index, cb) {
|
|||||||
|
|
||||||
var timeout = setTimeout(function () {
|
var timeout = setTimeout(function () {
|
||||||
torrentSummary.playStatus = 'timeout' /* no seeders available? */
|
torrentSummary.playStatus = 'timeout' /* no seeders available? */
|
||||||
state.location.clearPending()
|
|
||||||
playInterfaceSound('ERROR')
|
playInterfaceSound('ERROR')
|
||||||
|
cb(new Error('playback timed out'))
|
||||||
update()
|
update()
|
||||||
}, 10000) /* give it a few seconds */
|
}, 10000) /* give it a few seconds */
|
||||||
|
|
||||||
@@ -794,20 +794,13 @@ function openPlayerFromActiveTorrent (torrentSummary, index, timeout, cb) {
|
|||||||
ipcRenderer.once('wt-server-' + torrentSummary.infoHash, function (e, info) {
|
ipcRenderer.once('wt-server-' + torrentSummary.infoHash, function (e, info) {
|
||||||
clearTimeout(timeout)
|
clearTimeout(timeout)
|
||||||
|
|
||||||
/**
|
|
||||||
TODO: where do we know if it's unplayable?
|
|
||||||
if (err) {
|
|
||||||
torrentSummary.playStatus = 'unplayable'
|
|
||||||
playInterfaceSound('ERROR')
|
|
||||||
update()
|
|
||||||
return onError(err)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// if we timed out (user clicked play a long time ago), don't autoplay
|
// if we timed out (user clicked play a long time ago), don't autoplay
|
||||||
var timedOut = torrentSummary.playStatus === 'timeout'
|
var timedOut = torrentSummary.playStatus === 'timeout'
|
||||||
delete torrentSummary.playStatus
|
delete torrentSummary.playStatus
|
||||||
if (timedOut) return update()
|
if (timedOut) {
|
||||||
|
ipcRenderer.send('wt-stop-server')
|
||||||
|
return update()
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise, play the video
|
// otherwise, play the video
|
||||||
state.window.title = torrentSummary.files[state.playing.fileIndex].name
|
state.window.title = torrentSummary.files[state.playing.fileIndex].name
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ LocationHistory.prototype._go = function (page) {
|
|||||||
if (page.onbeforeload) {
|
if (page.onbeforeload) {
|
||||||
this._pending = page
|
this._pending = page
|
||||||
page.onbeforeload((err) => {
|
page.onbeforeload((err) => {
|
||||||
if (err) return
|
|
||||||
if (this._pending !== page) return /* navigation was cancelled */
|
if (this._pending !== page) return /* navigation was cancelled */
|
||||||
this._pending = null
|
this._pending = null
|
||||||
|
if (err) return
|
||||||
this._history.push(page)
|
this._history.push(page)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user