This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/helpers/playPop.js

11 lines
311 B
JavaScript
Raw Normal View History

export const playSoundWhenDoneKey = 'playSoundWhenTaskDone'
export const playPop = () => {
const enabled = localStorage.getItem(playSoundWhenDoneKey) === 'true' || localStorage.getItem(playSoundWhenDoneKey) === null
if(!enabled) {
return
}
feat: compress media files I created a new folder called "originalMedia" where I move all the uncompressed images. I moved most assets to the src folder. This makes the build a little bit slower but has the advantage that vite will can add a content hash. I converted llama-nightscape to jpg because I got better compression results with that. Not sure if that makes sense though (because of todays high dpi displays). Used for SVG: manual lossy (!) compression with SVGOMG https://jakearchibald.github.io/svgomg/ I would have loved to manually check the layers and see if I could combine / remove some manually. That's an optimisation step that SVGOMG obviously can't do. Sadly Inkscape seems to have some stability problems when opening these SVGs... weird. I did not compress the "safari-pinned-tab.svg" because SVGOMG seemed to have some problems with it. Used tool for oll other images: ImageOptim v1.8.8 (sadly just for macOS, but it simply combines many image compression api under one GUI, combines them sometimes, lets them compete and uses the best outcome). I stripped all meta data with a lossy (!) compression of 85% for JPEG, 80% for PNG (yes PNG supports lossy compression) and optimisation level "insane". I enabled all supported compression algorythms except Guetzli (time is just too crazy) I compressed the wav file with `ffmpeg -i pop.wav pop.mp3`. Note: I realised that the full-pride logo has a different outer offset that the other logo (from the circle around the llama). This seemed to be not by intend.
2021-09-14 09:47:37 +00:00
const popSound = new Audio('/audio/pop.mp3')
popSound.play()
}