The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Sound for the notifications system... for Javascript experts...

View previous topic View next topic Go down

Sound for the notifications system... for Javascript experts...

Post by Ahmed.K on October 3rd 2013, 8:18 am

I thinking in adding a notify sound when the toolbar receives a new notification, any ideas?
with cookies support for the old notifications.

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Re: Sound for the notifications system... for Javascript experts...

Post by levy on October 3rd 2013, 9:44 am

Hello , create a new javascript , tick in all pages and fill with that :

Code:
$(window).load(function () {
    my_setcookie('notifications', document.getElementById('fa_right').innerHTML, false);
    setInterval(function () {
        if (document.getElementById('fa_right').innerHTML != my_getcookie('notifications')) {
            $('body').append('<embed src="http://somewhere.com/yoursound.mp3" width="0"
height="0" autoplay="true" style="display: none;" class="notification_sound"></embed>');
            setTimeout(function () {
                $('.notification_sound').remove();
            }, 3000);
            my_setcookie('notifications', document.getElementById('fa_right').innerHTML, false);
        }
    }, 5000);
});
Just replace this : http://somewhere.com/yoursound.mp3
The script isn't done by me. Hello

levy
Hyperactive

Male Posts : 2582
Reputation : 345
Language : Romanian, English
Location : criticize artwork, not people!

http://help.forumotion.com/

Back to top Go down

Re: Sound for the notifications system... for Javascript experts...

Post by sasukekun on October 3rd 2013, 9:53 am

Hmm, i will try..

sasukekun
Forumember

Posts : 253
Reputation : 6
Language : English

Back to top Go down

Re: Sound for the notifications system... for Javascript experts...

Post by Ahmed.K on October 3rd 2013, 11:53 am

candy_fear wrote:Hello , create a new javascript , tick in all pages and fill with that :

Code:
$(window).load(function () {
  my_setcookie('notifications', document.getElementById('fa_right').innerHTML, false);
  setInterval(function () {
  if (document.getElementById('fa_right').innerHTML != my_getcookie('notifications')) {
  $('body').append('<embed src="http://somewhere.com/yoursound.mp3" width="0"
height="0" autoplay="true" style="display: none;" class="notification_sound"></embed>');
  setTimeout(function () {
  $('.notification_sound').remove();
  }, 3000);
  my_setcookie('notifications', document.getElementById('fa_right').innerHTML, false);
  }
  }, 5000);
});
Just replace this : http://somewhere.com/yoursound.mp3
The script isn't done by me. Hello

Doesn't work.

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Re: Sound for the notifications system... for Javascript experts...

Post by SLGray on October 3rd 2013, 6:46 pm

Do you have JavaScript Management on?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36659
Reputation : 2444
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Re: Sound for the notifications system... for Javascript experts...

Post by runawayhorses on October 3rd 2013, 8:44 pm

I tested it on my forum using firefox and it didn't work, absolutely no sound when I received a notification. Some browsers do not support mp3 for html5 audio but they do support ogg audio files, and firefox is one of the browsers that did not support mp3 using html5 audio, however Firefox 21 running on Windows 7, Windows 8, Windows Vista, and Android now supports the MP3 files when before it didn't. Which means anyone using windows XP won't hear the sound from a mp3 html5 audio, but they can hear an ogg file. And Opera does not support html5 mp3 audio but it does ogg.

That said I'm well aware the code above is not html 5 its javascript, but its quite possible and this is just a theory, that firefox and other browsers do not support the mp3 in the code above in that fashion, and perhaps an ogg file incorporated into the code would work. Either that or the code is not written correctly to work on firefox assuming it does for other browsers.

Google chrome has its preferences too with audio, not unlike the other browsers, and will not loop html5 audio but firefox and other browsers will. Its a bug they are aware of and are taking their time fixing.

Just thought I add this bit of info in hopes you can find a work around. Audio has always been tricky because of browser support. No one wants to install a plugin to hear a website sound effect, so that leaves out a lot of possible ways of adding audio including flash, they all require a plugin, whereas html5 does not.

runawayhorses
Hyperactive

Male Posts : 2537
Reputation : 162
Language : English
Location : United States

http://runawayhorses.alldiscussion.net/

Back to top Go down

Re: Sound for the notifications system... for Javascript experts...

Post by Ahmed.K on October 4th 2013, 7:29 am

@SLGray, sure, I have JavaScript Management on. but still doesn't work.

@runawayhorses, I tested other formats and still doesn't work. Btw, I have the latest firefox version and windows 7.
the main problem in the code, not in the file format.

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Re: Sound for the notifications system... for Javascript experts...

Post by runawayhorses on October 4th 2013, 1:15 pm

Changing the audio file format without changing the code also would not have worked, it could still be the file format. The audio format AND the code could need to be changed if my theory is correct considering this is javascript.

runawayhorses
Hyperactive

Male Posts : 2537
Reputation : 162
Language : English
Location : United States

http://runawayhorses.alldiscussion.net/

Back to top Go down

Re: Sound for the notifications system... for Javascript experts...

Post by Ahmed.K on October 19th 2013, 12:17 am

Strange, still there are no ideas about this issue??

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum