Log successful attempts to open an external player
This commit is contained in:
@@ -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 () {
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ function getDefaultPlayState () {
|
||||
location: 'local', /* 'local', 'chromecast', 'airplay' */
|
||||
type: null, /* 'audio' or 'video', could be 'other' if ever support eg streaming to VLC */
|
||||
currentTime: 0, /* seconds */
|
||||
duration: 1, /* seconds */,
|
||||
duration: 1, /* seconds */
|
||||
isReady: false,
|
||||
isPaused: true,
|
||||
isStalled: false,
|
||||
|
||||
@@ -67,6 +67,7 @@ function reset () {
|
||||
total: 0,
|
||||
success: 0,
|
||||
error: 0,
|
||||
external: 0,
|
||||
abandoned: 0
|
||||
}
|
||||
}
|
||||
@@ -209,10 +210,10 @@ function getElemString (elem) {
|
||||
return ret
|
||||
}
|
||||
|
||||
// The user pressed play. It either worked or showed the
|
||||
// 'Play in VLC' codec error
|
||||
// The user pressed play. Did it work, display an error,
|
||||
// open an external player or did user abandon the attempt?
|
||||
function logPlayAttempt (result) {
|
||||
if (!['success', 'error', 'abandoned'].includes(result)) {
|
||||
if (!['success', 'error', 'external', 'abandoned'].includes(result)) {
|
||||
return console.error('Unknown play attempt result', result)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user