Author Topic: Disable notification sounds  (Read 32678 times)

0 Members and 1 Guest are viewing this topic.

tom

  • Jr. Member
  • **
  • Posts: 2
Disable notification sounds
« on: May 20, 2011, 09:48:09 AM »
Hi, Done a lot of digging and searching around but cannot seem to find how to disable notification sounds. A lot of people have asked the question in the past but the answer never materialised. I was wondering if anybody could advise how it can be done before I start playing around myself.  :-\

Cheers
Tom

tom

  • Jr. Member
  • **
  • Posts: 2
Re: Disable notification sounds
« Reply #1 on: June 06, 2011, 06:47:01 AM »
Just coming back to this sound issue again as it causes a lot of issues if people don't have the correct plugins.. Surely someone has overcome this issue!?  :-\ Any help would be greatly appreciated.

Tom

DanKaplans

  • Jr. Member
  • **
  • Posts: 1
Re: Disable notification sounds
« Reply #2 on: August 28, 2011, 10:28:39 AM »
Any suggestions? I am also having the same problem.

MichaelTunnell

  • Native
  • *****
  • Posts: 50
  • Yesterday is History and Tomorrow is a Mystery
    • MichaelTunnell.com
Re: Disable notification sounds
« Reply #3 on: October 05, 2011, 06:23:45 PM »
do you want the sounds to be turned off by default or removed completely?

Also are you referring to sounds inside of chats for new messages or sounds in the admin?

Zappa

  • Jr. Member
  • **
  • Posts: 4
Re: Disable notification sounds
« Reply #4 on: December 15, 2011, 10:56:08 PM »
I also found this frustrating as if the user doesn't have Quicktime installed the browser keeps promting to install after every message which is annoying (and confusing) to end users. IMO there should be an option in admin settings to disable sound on the client side completely (i.e. don't even expose sound to the client side at all.

Turning the sound off by default won't help as the browser still seems to get the embed instruction and still prompts the user for the plugin. I managed to diable sound completely on the clinet side but it involved removing the playsound function from the JS files and only loading it for agents. Wasn't easy to change and won't be something that non-developers can do easily so an admin setting to turn sound off completely for end users would be awesome.

njak

  • Jr. Member
  • **
  • Posts: 1
Re: Disable notification sounds
« Reply #5 on: January 09, 2012, 08:10:11 PM »
Quote
Zappa: Turning the sound off by default won't help as the browser still seems to get the embed instruction and still prompts the user for the plugin. I managed to diable sound completely on the clinet side but it involved removing the playsound function from the JS files and only loading it for agents. Wasn't easy to change and won't be something that non-developers can do easily so an admin setting to turn sound off completely for end users would be awesome.

Anyway you can post what you did or at least give us a clue what to look for?

Zappa

  • Jr. Member
  • **
  • Posts: 4
Re: Disable notification sounds
« Reply #6 on: January 17, 2012, 08:36:54 PM »
I will dig through my code and post here what I can when I find it. It wasn't an easy thing to find or change and had to make some core file changes which I wouldn't recommend for the faint hearted :)

Quote
Zappa: Turning the sound off by default won't help as the browser still seems to get the embed instruction and still prompts the user for the plugin. I managed to diable sound completely on the clinet side but it involved removing the playsound function from the JS files and only loading it for agents. Wasn't easy to change and won't be something that non-developers can do easily so an admin setting to turn sound off completely for end users would be awesome.

Anyway you can post what you did or at least give us a clue what to look for?

Zappa

  • Jr. Member
  • **
  • Posts: 4
Re: Disable notification sounds
« Reply #7 on: January 17, 2012, 09:15:27 PM »
Okay I had a look at my code. What I did was get hold of the un-minified js files and removed the sound function from common.js:
Code: [Select]
function playSound(wav_file) {
  var player = document.createElement("div");
  var agt = navigator.userAgent.toLowerCase();
  if(agt.indexOf('opera') != -1) {
  player.style = "position: absolute; left: 0px; top: -200px;";
  }
  document.body.appendChild(player);
  player.innerHTML = '<embed src="'+wav_file+'" hidden="true" autostart="true" loop="false">';
}
and placed it into a new js file called "sound.js" in the /js/164 folder. I then linked to this file from the chat.tpl file in my relevant /style folder with code instructions for only agents to load the file like this:
Code: [Select]
${if:agent}
<script type="text/javascript" src="${webimroot}/js/${jsver}/sound.js"></script>
${endif:agent}

Next was to stop the function from executing in case it gets called by client scripts somewhere along the line so in chats.js change this code:
Code: [Select]
if(!this.skipNextsound) {
var tsound = $('soundimg');
if(tsound == null || tsound.className.match(new RegExp("\\bisound\\b")) ) {
playSound(Chat.webimRoot+'/sounds/new_message.wav');
}
}

and replace it with this:
Code: [Select]
if (typeof playSound=="function") {
if(!this.skipNextsound) {
var tsound = $('soundimg');
if(tsound == null || tsound.className.match(new RegExp("\\bisound\\b")) ) {
playSound(Chat.webimRoot+'/sounds/new_message.wav');
}
}
}
What that means is that any only agents will get sound notifications for new messages and clients don't get the instruction to embed the Quicktime object in their browser. I actually edited the minified verions of these js files with the minified code versions of the above changes but I wouldn't recommend that to most people :)

Something else to keep in mind is that only the javascript files in the /js/164 folder are actually used during script execution. The /js/source folder only contains the unminified versions of the files in the /js/164 folder for reference so any changes have to be made to the files in the /js/164 folder to have any effect.
« Last Edit: January 17, 2012, 09:18:50 PM by Zappa »

egifford

  • Jr. Member
  • **
  • Posts: 1
Re: Disable notification sounds
« Reply #8 on: November 14, 2012, 07:39:25 PM »
Responding to such an old post may be bad form, but I wanted to add that I just made this change to 1.6.4 and it works great.  Sound is disabled and the end user to our site is no longer asked to allow plugins to work.

Thanks, Zappa, for the code!

okpa

  • Jr. Member
  • **
  • Posts: 2
Re: Disable notification sounds
« Reply #9 on: April 08, 2013, 03:08:30 PM »
not work
« Last Edit: April 09, 2013, 09:28:41 PM by okpa »