Don't load cast module when seeking
This commit is contained in:
@@ -306,14 +306,14 @@ function playPause (isPaused) {
|
|||||||
return // Nothing to do
|
return // Nothing to do
|
||||||
}
|
}
|
||||||
// Either isPaused is undefined, or it's the opposite of the current state. Toggle.
|
// Either isPaused is undefined, or it's the opposite of the current state. Toggle.
|
||||||
if (lazyLoadCast().isCasting()) {
|
if (isCasting()) {
|
||||||
Cast.playPause()
|
Cast.playPause()
|
||||||
}
|
}
|
||||||
state.playing.isPaused = !state.playing.isPaused
|
state.playing.isPaused = !state.playing.isPaused
|
||||||
}
|
}
|
||||||
|
|
||||||
function jumpToTime (time) {
|
function jumpToTime (time) {
|
||||||
if (lazyLoadCast().isCasting()) {
|
if (isCasting()) {
|
||||||
Cast.seek(time)
|
Cast.seek(time)
|
||||||
} else {
|
} else {
|
||||||
state.playing.jumpToTime = time
|
state.playing.jumpToTime = time
|
||||||
@@ -325,16 +325,26 @@ function changeVolume (delta) {
|
|||||||
setVolume(state.playing.volume + delta)
|
setVolume(state.playing.volume + delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: never called. Either remove or make a volume control that calls it
|
||||||
function setVolume (volume) {
|
function setVolume (volume) {
|
||||||
// check if its in [0.0 - 1.0] range
|
// check if its in [0.0 - 1.0] range
|
||||||
volume = Math.max(0, Math.min(1, volume))
|
volume = Math.max(0, Math.min(1, volume))
|
||||||
if (lazyLoadCast().isCasting()) {
|
if (isCasting()) {
|
||||||
Cast.setVolume(volume)
|
Cast.setVolume(volume)
|
||||||
} else {
|
} else {
|
||||||
state.playing.setVolume = volume
|
state.playing.setVolume = volume
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks whether we are connected and already casting
|
||||||
|
// Returns false if we not casting (state.playing.location === 'local')
|
||||||
|
// or if we're trying to connect but haven't yet ('chromecast-pending', etc)
|
||||||
|
function isCasting () {
|
||||||
|
return state.playing.location === 'chromecast' ||
|
||||||
|
state.playing.location === 'airplay' ||
|
||||||
|
state.playing.location === 'dlna'
|
||||||
|
}
|
||||||
|
|
||||||
function setupIpc () {
|
function setupIpc () {
|
||||||
ipcRenderer.send('ipcReady')
|
ipcRenderer.send('ipcReady')
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ module.exports = {
|
|||||||
stopCasting,
|
stopCasting,
|
||||||
playPause,
|
playPause,
|
||||||
seek,
|
seek,
|
||||||
setVolume,
|
setVolume
|
||||||
isCasting
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback to notify module users when state has changed
|
// Callback to notify module users when state has changed
|
||||||
@@ -285,13 +284,6 @@ function stoppedCasting () {
|
|||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks whether we are connected and already casting
|
|
||||||
// Returns false if we not casting (state.playing.location === 'local')
|
|
||||||
// or if we're trying to connect but haven't yet ('chromecast-pending', etc)
|
|
||||||
function isCasting () {
|
|
||||||
return state.playing.location === 'chromecast' || state.playing.location === 'airplay' || state.playing.location === 'dlna'
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDevice (location) {
|
function getDevice (location) {
|
||||||
if (location && state.devices[location]) {
|
if (location && state.devices[location]) {
|
||||||
return state.devices[location]
|
return state.devices[location]
|
||||||
|
|||||||
Reference in New Issue
Block a user