What Template is The Alert Counter In?

Any idea why I can place:
Code:
<embed src="alert.mp3" autostart="true" hidden="true" height="0" width="0">

Inside:
Code:
<span class="arrow"></span>

And it play the Alert MP3 only when I have an alert, but not in Internet Explorer? Works in Firefox, and Chrome, but has issues in IE for some reason?
 
I found this:

http://www.sitepoint.com/forums/sho...n-embedded-mp3-to-play-in-both-Firefox-and-IE

Here's the solution. I got this from the creator of the Greasemonkey Scripts (scripts that help you embed media that works in both Firefox and IE).

Short answer - use this code instead:

HTML:
<embed src="ft.mp3" type="application/x-mplayer2" autostart="true" playcount="true" loop="true" height="0" width="0">

Explanation (if you're interested):
"Isn't Firefox smart enough to realize that I still have Windows Media Player available to play it with?"
That's not how it works. IE uses Windows Media Player itself to play any media file that WMP recognises. All other browsers must use the 7-year-old WMP plugin. Browser plugins have a list inside them of the file extensions and MIME Types they can play. A browser is supposed to use these lists to choose a plugin to play a file. The WMP plugin only lists the Windows Media formats: .asf, .asx, .wm, .wma, .wax, .wmv, and .wvx
Since Firefox obeys those lists (as it should), it will not use the WMP plugin to play an mp3, because the WMP plugin does not list mp3's.

Adding TYPE="application/x-mplayer2" was the correct solution - application/x-mplayer2 is a MIME Type that the WMP plugin lists (MIME Types are file identifiers used on the internet), and the type attribute overrides the actual file extension and MIME type of the file to be played.
Unfortunately, IE ignores MIME Types and file extensions - instead it examines the contents of the file and decides for itself what format it is and what to do with it. It plays with Quicktime on your win2k box because its browser plugin must list mp3 files. IE will use WMP to play a media file unless another browser plugin lists it.

Also, the WMP plugin does not support all the same parameters as the WMP ActiveX control (what IE uses) and the Quicktime plugin. For example, Quicktime does not support the 'showControls' parameter - which is WMP only (since for the WMP plugin the controls are only a part of the UI, not all of it)
And the WMP plugin does not support the hidden parameter properly - it prevents it from autostarting.
The best way to hide a player that will work for all media player plugins is to set the width and height to 0
The WMP plugin also doesn't support the loop parameter - it needs playcount instead.

Use this code instead:

HTML:
<embed src="ft.mp3" type="application/x-mplayer2" autostart="true" playcount="true" loop="true" height="0" width="0">

It will work in all browsers - autostart, hidden, and loop to infinity (that's what you wanted, right?) and in all Windows browsers bar IE it will play with the WMP plugin. IE will use whatever browser plugin is associated with mp3's, else it will use WMP.
 
Sorry, let me further explain. Im trying to get a sound alert for new conversations/alerts.
After adding <embed src="alert.mp3" autostart="true" hidden="true" height="0" width="0"> to the conversation line in navigation_visitor_tab:

<a href="{xen:link conversations}" rel="Menu" class="navLink NoPopupGadget">{xen:phrase inbox}
<strong class="itemCount {xen:if {$visitor.conversations_unread}, '', 'Zero'}"
id="ConversationsMenu_Counter" data-text="{xen:phrase you_have_x_new_unread_conversations}">
<span class="Total">{xen:number $visitor.conversations_unread}</span>
<span class="arrow"><embed src="alert.mp3" autostart="true" hidden="true" height="0" width="0"></span>

The notification works in Firefox, Chrome, Safari, ect. (IE, the alert will play when I get a new conversation) however in IE no matter if I have a new conversation or not, the sound will play. Whats going on?
 
Top Bottom