diff --git a/renderer/controllers/playback-controller.js b/renderer/controllers/playback-controller.js index 126fb5df..b3cbda5f 100644 --- a/renderer/controllers/playback-controller.js +++ b/renderer/controllers/playback-controller.js @@ -197,6 +197,10 @@ function openPlayer (state, infoHash, index, cb) { } } +function getOpenInVlc () { + return state.saved.prefs.playInVlc +} + function openPlayerFromActiveTorrent (state, torrentSummary, index, timeout, cb) { var fileSummary = torrentSummary.files[index] @@ -241,6 +245,14 @@ function openPlayerFromActiveTorrent (state, torrentSummary, index, timeout, cb) return this.update() } + // play in VLC if set as default player (Preferences / Playback / Play in VLC) + if (getOpenInVlc()) { + dispatch('vlcPlay') + this.update() + cb() + return + } + // otherwise, play the video state.window.title = torrentSummary.files[state.playing.fileIndex].name this.update() diff --git a/renderer/main.js b/renderer/main.js index d94ea4b8..c5a60f0e 100644 --- a/renderer/main.js +++ b/renderer/main.js @@ -166,10 +166,6 @@ function updateElectron () { } } -function getOpenInVlc () { - return state.saved.prefs.playInVlc -} - const dispatchHandlers = { // Torrent list: creating, deleting, selecting torrents 'openTorrentFile': () => ipcRenderer.send('openTorrentFile'), @@ -320,8 +316,8 @@ function escapeBack () { dispatch('toggleFullScreen') } else { dispatch('back') -} } +} // Starts all torrents that aren't paused on program startup function resumeTorrents () {