Fix error handling in dispatch('play')
This commit is contained in:
@@ -273,14 +273,7 @@ function dispatch (action, ...args) {
|
|||||||
playPause()
|
playPause()
|
||||||
}
|
}
|
||||||
if (action === 'play') {
|
if (action === 'play') {
|
||||||
state.location.go({
|
playFile(args[0] /* infoHash */, args[1] /* index */)
|
||||||
url: 'player',
|
|
||||||
onbeforeload: function (cb) {
|
|
||||||
play()
|
|
||||||
openPlayer(args[0] /* infoHash */, args[1] /* index */, cb)
|
|
||||||
},
|
|
||||||
onbeforeunload: closePlayer
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if (action === 'playbackJump') {
|
if (action === 'playbackJump') {
|
||||||
jumpToTime(args[0] /* seconds */)
|
jumpToTime(args[0] /* seconds */)
|
||||||
@@ -992,7 +985,20 @@ function pickFileToPlay (files) {
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens the video player
|
function playFile (infoHash, index) {
|
||||||
|
state.location.go({
|
||||||
|
url: 'player',
|
||||||
|
onbeforeload: function (cb) {
|
||||||
|
play()
|
||||||
|
openPlayer(infoHash, index, cb)
|
||||||
|
},
|
||||||
|
onbeforeunload: closePlayer
|
||||||
|
}, function (err) {
|
||||||
|
if (err) onError(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opens the video player to a specific torrent
|
||||||
function openPlayer (infoHash, index, cb) {
|
function openPlayer (infoHash, index, cb) {
|
||||||
var torrentSummary = getTorrentSummary(infoHash)
|
var torrentSummary = getTorrentSummary(infoHash)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user