sound: remove preloading
Sound playing is basically instant -- I was over-engineering when I added this.
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
preload,
|
|
||||||
play
|
play
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,17 +46,6 @@ const sounds = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function preload () {
|
|
||||||
for (let name in sounds) {
|
|
||||||
if (!cache[name]) {
|
|
||||||
const sound = sounds[name]
|
|
||||||
const audio = cache[name] = new window.Audio()
|
|
||||||
audio.volume = sound.volume
|
|
||||||
audio.src = sound.url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function play (name) {
|
function play (name) {
|
||||||
let audio = cache[name]
|
let audio = cache[name]
|
||||||
if (!audio) {
|
if (!audio) {
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ function onState (err, _state) {
|
|||||||
// Runs a few seconds after the app loads, to avoid slowing down startup time
|
// Runs a few seconds after the app loads, to avoid slowing down startup time
|
||||||
function delayedInit () {
|
function delayedInit () {
|
||||||
lazyLoadCast()
|
lazyLoadCast()
|
||||||
sound.preload()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lazily loads Chromecast and Airplay support
|
// Lazily loads Chromecast and Airplay support
|
||||||
|
|||||||
Reference in New Issue
Block a user