Add ringtone

This commit is contained in:
Quentin ANIERE 2022-04-14 15:32:45 +02:00
parent e18cb3854a
commit 5fdbde912b
3 changed files with 6 additions and 0 deletions

View File

@ -57,6 +57,7 @@
<img id="send" src="./images/send.png"> <img id="send" src="./images/send.png">
<img id="close" src="./images/cross.png"> <img id="close" src="./images/cross.png">
</div> </div>
<audio id="ringtone" src="./ringtone.mp3"></audio>
<script src="https://danby.aniere.fr:3000/socket.io/socket.io.js"></script> <script src="https://danby.aniere.fr:3000/socket.io/socket.io.js"></script>
<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script> <script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>
<script src="script.js"></script> <script src="script.js"></script>

BIN
src/ringtone.mp3 Normal file

Binary file not shown.

View File

@ -29,6 +29,11 @@ document.addEventListener("DOMContentLoaded", () => {
}); });
socket.on("new-message", (data) => { socket.on("new-message", (data) => {
if(data.author != username) {
document.getElementById("ringtone").play();
}
addMessage(data.author, data.message); addMessage(data.author, data.message);
}); });