sound in chat?

General Chat, Comments
Post Reply
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

sound in chat?

Post by KaL »

i try to insert a sound in the game like this:

Code: Select all

<?php 
echo "<embed src='clink_sound.mp3' autostart='true' loop='false'></embed>";
?>
it works for a module but i can't seem to get it to work for chat module.

any help pls.
User avatar
Chris
Posts: 1580
Joined: Wed Sep 30, 2009 7:22 pm

Re: sound in chat?

Post by Chris »

This would require someone to load a plugin like Windows Media Player, VLC or quicktime within the browser. You would be better off resorting to the new HTML5 audio tag as this would use a browser native audio decoder.

http://www.w3schools.com/html/html5_audio.asp

Code: Select all

echo '<audio controls>
        <source src="clink_sound.mp3" type="audio/mpeg">
     </audio>';
 
May I ask, as I noticed the file name is "clink_sound.mp3", what is variable about it? Is it an audio someone places in the chat, or is it a sound when someone receives a message? In this case it would be better to play the sound through JavaScript as your DOM will become cluttered with audio objects.
Fighting for peace is declaring war on war. If you want peace be peaceful.
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

Re: sound in chat?

Post by KaL »

i just use that sound to send out alert every time someone chat, when the chat window is minimize. Yup! i even use Html 5 audio tag code you suggested but i can't seem to get it working. i even try to put the tag everywhere and still no result (trying to add in the javascript/ajax-chat_bar module). if you can look into the chat_bar module and tell me where should i add this script that would be great. thank you!


the location of this "clink.mp3" at the beginning of the directory where the "index.php" file is located. I figure this way i won't have any permission problem accessing it.
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: sound in chat?

Post by a_bertrand »

Did you managed to implement it?
Creator of Dot World Maker
Mad programmer and annoying composer
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

Re: sound in chat?

Post by KaL »

Nope. I add the script to the chat_bar.js everywhere and it did not work. I tried the html5 audio tag and even the javascript audio script.
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: sound in chat?

Post by a_bertrand »

Currently I'm totally overbooked (sadly), however I will do my best to squash a bit of time this week for this and come with something.
Creator of Dot World Maker
Mad programmer and annoying composer
Post Reply

Return to “General”