mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Add sounds.
This commit is contained in:
@@ -1,7 +1,13 @@
|
|||||||
|
import catSoundOgg from "../sound/reactions/cat.mp3?url";
|
||||||
|
import catSoundMp3 from "../sound/reactions/cat.mp3?url";
|
||||||
|
import cricketsSoundOgg from "../sound/reactions/crickets.mp3?url";
|
||||||
|
import cricketsSoundMp3 from "../sound/reactions/crickets.mp3?url";
|
||||||
import dogSoundOgg from "../sound/reactions/dog.ogg?url";
|
import dogSoundOgg from "../sound/reactions/dog.ogg?url";
|
||||||
import dogSoundMp3 from "../sound/reactions/dog.mp3?url";
|
import dogSoundMp3 from "../sound/reactions/dog.mp3?url";
|
||||||
import lightbulbOgg from "../sound/reactions/lightbulb.mp3?url";
|
import genericSoundOgg from "../sound/reactions/generic.mp3?url";
|
||||||
import lightbulbMp3 from "../sound/reactions/lightbulb.mp3?url";
|
import genericSoundMp3 from "../sound/reactions/generic.mp3?url";
|
||||||
|
import lightbulbSoundOgg from "../sound/reactions/lightbulb.mp3?url";
|
||||||
|
import lightbulbSoundMp3 from "../sound/reactions/lightbulb.mp3?url";
|
||||||
import { RelationType } from "matrix-js-sdk/src/types";
|
import { RelationType } from "matrix-js-sdk/src/types";
|
||||||
|
|
||||||
export interface ReactionOption {
|
export interface ReactionOption {
|
||||||
@@ -26,18 +32,13 @@ export interface ECallReactionEventContent {
|
|||||||
export const GenericReaction: ReactionOption = {
|
export const GenericReaction: ReactionOption = {
|
||||||
name: "generic",
|
name: "generic",
|
||||||
emoji: "", // Filled in by user
|
emoji: "", // Filled in by user
|
||||||
|
sound: {
|
||||||
|
mp3: genericSoundMp3,
|
||||||
|
ogg: genericSoundOgg,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ReactionSet: ReactionOption[] = [
|
export const ReactionSet: ReactionOption[] = [
|
||||||
{
|
|
||||||
emoji: "🐶",
|
|
||||||
name: "dog",
|
|
||||||
alias: ["doggo", "pupper", "woofer"],
|
|
||||||
sound: {
|
|
||||||
ogg: dogSoundOgg,
|
|
||||||
mp3: dogSoundMp3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
emoji: "👍",
|
emoji: "👍",
|
||||||
name: "thumbsup",
|
name: "thumbsup",
|
||||||
@@ -53,15 +54,41 @@ export const ReactionSet: ReactionOption[] = [
|
|||||||
name: "party",
|
name: "party",
|
||||||
alias: ["hurray", "success"],
|
alias: ["hurray", "success"],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
emoji: "🐶",
|
||||||
|
name: "dog",
|
||||||
|
alias: ["doggo", "pupper", "woofer"],
|
||||||
|
sound: {
|
||||||
|
ogg: dogSoundOgg,
|
||||||
|
mp3: dogSoundMp3,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
emoji: "🦗",
|
emoji: "🦗",
|
||||||
name: "crickets",
|
name: "crickets",
|
||||||
alias: ["awkward", "silence"],
|
alias: ["awkward", "silence"],
|
||||||
|
sound: {
|
||||||
|
ogg: cricketsSoundOgg,
|
||||||
|
mp3: cricketsSoundMp3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
emoji: "🐱",
|
emoji: "🐱",
|
||||||
name: "cat",
|
name: "cat",
|
||||||
alias: ["meow", "kitty"],
|
alias: ["meow", "kitty"],
|
||||||
|
sound: {
|
||||||
|
ogg: catSoundOgg,
|
||||||
|
mp3: catSoundMp3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
emoji: "💡",
|
||||||
|
name: "lightbulb",
|
||||||
|
alias: ["bulb", "light", "idea", "ping"],
|
||||||
|
sound: {
|
||||||
|
ogg: lightbulbSoundOgg,
|
||||||
|
mp3: lightbulbSoundMp3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
emoji: "😵💫",
|
emoji: "😵💫",
|
||||||
@@ -73,13 +100,4 @@ export const ReactionSet: ReactionOption[] = [
|
|||||||
name: "ok",
|
name: "ok",
|
||||||
alias: ["okay", "cool"],
|
alias: ["okay", "cool"],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
emoji: "💡",
|
|
||||||
name: "lightbulb",
|
|
||||||
alias: ["bulb", "light", "idea", "ping"],
|
|
||||||
sound: {
|
|
||||||
ogg: lightbulbOgg,
|
|
||||||
mp3: lightbulbMp3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -188,10 +188,6 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
[reactions],
|
[reactions],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log("Got reaction change", reactionsSet);
|
|
||||||
}, [reactionsSet]);
|
|
||||||
|
|
||||||
useWakeLock();
|
useWakeLock();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
BIN
src/sound/reactions/cat.mp3
Normal file
BIN
src/sound/reactions/cat.mp3
Normal file
Binary file not shown.
BIN
src/sound/reactions/cat.ogg
Normal file
BIN
src/sound/reactions/cat.ogg
Normal file
Binary file not shown.
BIN
src/sound/reactions/crickets.mp3
Normal file
BIN
src/sound/reactions/crickets.mp3
Normal file
Binary file not shown.
BIN
src/sound/reactions/crickets.ogg
Normal file
BIN
src/sound/reactions/crickets.ogg
Normal file
Binary file not shown.
BIN
src/sound/reactions/generic.mp3
Normal file
BIN
src/sound/reactions/generic.mp3
Normal file
Binary file not shown.
BIN
src/sound/reactions/generic.ogg
Normal file
BIN
src/sound/reactions/generic.ogg
Normal file
Binary file not shown.
@@ -214,10 +214,13 @@ export const ReactionsProvider = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// One of our custom reactions
|
// One of our custom reactions
|
||||||
const reaction = ReactionSet.find((r) => r.name === content.name) ?? {
|
const reaction = {
|
||||||
...GenericReaction,
|
...GenericReaction,
|
||||||
emoji: content.emoji,
|
emoji: content.emoji,
|
||||||
|
// If we don't find a reaction, we can fallback to the generic sound.
|
||||||
|
...ReactionSet.find((r) => r.name === content.name),
|
||||||
};
|
};
|
||||||
|
|
||||||
setReactions((reactions) => {
|
setReactions((reactions) => {
|
||||||
if (reactions[sender]) {
|
if (reactions[sender]) {
|
||||||
// We've still got a reaction from this user, ignore it to prevent spamming
|
// We've still got a reaction from this user, ignore it to prevent spamming
|
||||||
|
|||||||
Reference in New Issue
Block a user