Embed resources

This commit is contained in:
Philipp Heckel 2022-03-09 15:58:21 -05:00
parent 8c8a1685b2
commit 04ee6b8be2
28 changed files with 60 additions and 57 deletions

View file

@ -1,4 +1,11 @@
import {rawEmojis} from "./emojis";
import beep from "../sounds/beep.mp3";
import juntos from "../sounds/juntos.mp3";
import pristine from "../sounds/pristine.mp3";
import ding from "../sounds/ding.mp3";
import dadum from "../sounds/dadum.mp3";
import pop from "../sounds/pop.mp3";
import popSwoosh from "../sounds/pop-swoosh.mp3";
export const topicUrl = (baseUrl, topic) => `${baseUrl}/${topic}`;
export const topicUrlWs = (baseUrl, topic) => `${topicUrl(baseUrl, topic)}/ws`
@ -34,7 +41,6 @@ const toEmojis = (tags) => {
else return tags.filter(tag => tag in emojis).map(tag => emojis[tag]);
}
export const formatTitleWithDefault = (m, fallback) => {
if (m.title) {
return formatTitle(m);
@ -123,8 +129,18 @@ export const subscriptionRoute = (subscription) => {
return `/${subscription.topic}`;
}
export const sounds = {
"beep": beep,
"juntos": juntos,
"pristine": pristine,
"ding": ding,
"dadum": dadum,
"pop": pop,
"pop-swoosh": popSwoosh
};
export const playSound = async (sound) => {
const audio = new Audio(`/static/sounds/${sound}.mp3`);
const audio = new Audio(sounds[sound]);
return audio.play();
};