Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit c15f1c2

Browse files
committed
Added sound helper
1 parent 1799b66 commit c15f1c2

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function playAudioByID(audioID) {
2+
document.getElementById(audioID).play();
3+
}
4+
5+
function pauseAudioByID(audioID) {
6+
document.getElementById(audioID).pause();
7+
}
8+
9+
function setAudioVolumeByID(audioID, volume) {
10+
//0.0 - 1.0
11+
document.getElementById(audioID).volume = volume;
12+
}
13+
14+
function audioOnOff(audioID) {
15+
if (document.getElementById(audioID).paused) {
16+
playAudioByID(audioID);
17+
} else {
18+
pauseAudioByID(audioID);
19+
}
20+
}
21+
22+
export { pauseAudioByID, playAudioByID, setAudioVolumeByID, audioOnOff };
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React, {ReactElement} from "react";
2+
//Assets
3+
import viking_ship from "../../assets/music/2017-04-01_-_Viking_Ship_-_David_Fesliyan.mp3"
4+
5+
export default function PermanentAssets():ReactElement {
6+
return (
7+
<div></div>
8+
)
9+
}

0 commit comments

Comments
 (0)