[Glitch] Fix sounds not being loaded from assets host
Port 01b9ee2b81
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
lolsob-rspec
parent
9af6f6db1a
commit
3890b5c5fd
|
@ -1,5 +1,8 @@
|
||||||
import type { Middleware, AnyAction } from 'redux';
|
import type { Middleware, AnyAction } from 'redux';
|
||||||
|
|
||||||
|
import ready from 'flavours/glitch/ready';
|
||||||
|
import { assetHost } from 'flavours/glitch/utils/config';
|
||||||
|
|
||||||
import type { RootState } from '..';
|
import type { RootState } from '..';
|
||||||
|
|
||||||
interface AudioSource {
|
interface AudioSource {
|
||||||
|
@ -35,18 +38,20 @@ export const soundsMiddleware = (): Middleware<
|
||||||
Record<string, never>,
|
Record<string, never>,
|
||||||
RootState
|
RootState
|
||||||
> => {
|
> => {
|
||||||
const soundCache: { [key: string]: HTMLAudioElement } = {
|
const soundCache: { [key: string]: HTMLAudioElement } = {};
|
||||||
boop: createAudio([
|
|
||||||
|
void ready(() => {
|
||||||
|
soundCache.boop = createAudio([
|
||||||
{
|
{
|
||||||
src: '/sounds/boop.ogg',
|
src: `${assetHost}/sounds/boop.ogg`,
|
||||||
type: 'audio/ogg',
|
type: 'audio/ogg',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: '/sounds/boop.mp3',
|
src: `${assetHost}/sounds/boop.mp3`,
|
||||||
type: 'audio/mpeg',
|
type: 'audio/mpeg',
|
||||||
},
|
},
|
||||||
]),
|
]);
|
||||||
};
|
});
|
||||||
|
|
||||||
return () =>
|
return () =>
|
||||||
(next) =>
|
(next) =>
|
||||||
|
|
Loading…
Reference in New Issue