Log successful attempts to open an external player

This commit is contained in:
Adam Gotlib
2016-10-11 11:42:04 +02:00
committed by Dan Flettre
parent de2db211cc
commit d8904aaf6e
4 changed files with 14 additions and 8 deletions

View File

@@ -56,7 +56,10 @@ module.exports = class MediaController {
const state = this.state
state.playing.location = 'external'
let open = function () {
const onServerRunning = function () {
state.playing.isReady = true
telemetry.logPlayAttempt('external')
const mediaURL = Playlist.getCurrentLocalURL(state)
ipcRenderer.send('openExternalPlayer',
state.saved.prefs.externalPlayerPath,
@@ -64,8 +67,8 @@ module.exports = class MediaController {
state.window.title)
}
if (state.server != null) open()
else ipcRenderer.once('wt-server-running', open)
if (state.server != null) onServerRunning()
else ipcRenderer.once('wt-server-running', onServerRunning)
}
externalPlayerNotFound () {

View File

@@ -223,6 +223,8 @@ module.exports = class PlaybackController {
// Starts WebTorrent server for media streaming
startServer (torrentSummary) {
const state = this.state
if (torrentSummary.status === 'paused') {
dispatch('startTorrentingSummary', torrentSummary.torrentKey)
ipcRenderer.once('wt-ready-' + torrentSummary.infoHash,
@@ -233,7 +235,7 @@ module.exports = class PlaybackController {
function onTorrentReady () {
ipcRenderer.send('wt-start-server', torrentSummary.infoHash)
ipcRenderer.once('wt-server-running', () => state.playing.isReady = true)
ipcRenderer.once('wt-server-running', () => { state.playing.isReady = true })
}
}