Skip to content
Snippets Groups Projects
Unverified Commit 1392f31e authored by Stanislas Signoud's avatar Stanislas Signoud Committed by GitHub
Browse files

Fix sounds not being loaded from assets host (#25931)

parent ca955ada
No related branches found
No related tags found
No related merge requests found
import type { Middleware, AnyAction } from 'redux';
import ready from 'mastodon/ready';
import { assetHost } from 'mastodon/utils/config';
import type { RootState } from '..';
interface AudioSource {
......@@ -35,18 +38,20 @@ export const soundsMiddleware = (): Middleware<
Record<string, never>,
RootState
> => {
const soundCache: { [key: string]: HTMLAudioElement } = {
boop: createAudio([
const soundCache: { [key: string]: HTMLAudioElement } = {};
void ready(() => {
soundCache.boop = createAudio([
{
src: '/sounds/boop.ogg',
src: `${assetHost}/sounds/boop.ogg`,
type: 'audio/ogg',
},
{
src: '/sounds/boop.mp3',
src: `${assetHost}/sounds/boop.mp3`,
type: 'audio/mpeg',
},
]),
};
]);
});
return () =>
(next) =>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment