mirror of
https://github.com/Mibew/design.git
synced 2024-11-16 01:44:11 +03:00
fix sound, works under Mac/Win in Opera, FF, IE (win only :), Safari
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@227 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
a345aca3b6
commit
b9a1995cf5
@ -117,7 +117,7 @@ public class JSO {
|
||||
"XMLDocument", "y", "zIndex",
|
||||
// non-IE
|
||||
"outerHeight", "innerHeight", "outerWidth", "innerWidth",
|
||||
"which",
|
||||
"which", "enabledPlugin",
|
||||
|
||||
// collections
|
||||
"all", "anchors", "applets", "areas", "attributes", "behaviorUrns",
|
||||
|
@ -519,15 +519,27 @@ var CommonUtils = {
|
||||
}
|
||||
};
|
||||
|
||||
function getWavMimeType() {
|
||||
var mimeType = "application/x-mplayer2"; //default
|
||||
var agt=navigator.userAgent.toLowerCase();
|
||||
if (navigator.mimeTypes && agt.indexOf("windows")==-1) {
|
||||
//non-IE, no-Windows
|
||||
var plugin=navigator.mimeTypes["audio/mpeg"].enabledPlugin;
|
||||
if (plugin || agt.indexOf("opera")>=0) mimeType="audio/mpeg"; //Mac/Safari & Linux/FFox
|
||||
}//end no-Windows
|
||||
return mimeType;
|
||||
}
|
||||
|
||||
function playSound(wav_file) {
|
||||
var player = document.getElementById("player");
|
||||
if (player) {
|
||||
player.parentNode.removeChild(player);
|
||||
}
|
||||
player = document.body.appendChild(document.createElement("div"));
|
||||
if(navigator.userAgent.indexOf('MSIE') != -1) {
|
||||
player.innerHTML = '<bgsound src="'+wav_file+'">';
|
||||
var agt=navigator.userAgent.toLowerCase();
|
||||
if(agt.indexOf('safari') == -1 && agt.indexOf('windows') != -1) {
|
||||
player.innerHTML = '<embed type="'+getWavMimeType()+'" src="'+wav_file+'" loop="0" autostart="1" width="0" height="0">';
|
||||
} else {
|
||||
player.innerHTML = '<div style="position: static; width: 0px; height: 0px"><embed type="audio/mpeg" src="'+wav_file+'" hidden="true" loop="false" autostart="true"></div>';
|
||||
player.innerHTML = '<div style="position: static; width: 0px; height: 0px"><embed type="'+getWavMimeType()+'" src="'+wav_file+'" hidden="true" loop="false" autostart="true"></div>';
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
var myAgent="";var uk=0;var myRealAgent="";function hk(){var ik=["\157pera","\u006ds\151\145","\u0073\u0061fa\162\151","\u0066\u0069r\u0065fox","n\u0065t\u0073cap\145","\u006d\u006fz\u0069l\154\u0061"];var dj=navigator.userAgent.toLowerCase();for(var i=0;i<ik.length;i++){var jk=ik[i];if(dj.indexOf(jk)!=-1){myAgent=jk;if(!window.RegExp)break;var kk=new RegExp(jk+"[ \/]\u003f(\u005b\060\055\071]\053\u0028\.\u005b0\u002d9]\u002b\u0029\u003f)");if(kk.exec(dj)!=null){uk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="\107e\u0063\153\u006f")myAgent="mo\u007a";} hk();function getEl(name){return document.getElementById(name);}
|
||||
var myAgent="";var jk=0;var myRealAgent="";function kk(){var lk=["\157pe\162a","\u006d\163\151\145","saf\u0061\u0072i","\u0066i\162\u0065\u0066\157\170","n\u0065t\163c\u0061p\145","m\u006fzil\154a"];var gj=navigator.userAgent.toLowerCase();for(var i=0;i<lk.length;i++){var ok=lk[i];if(gj.indexOf(ok)!=-1){myAgent=ok;if(!window.RegExp)break;var pk=new RegExp(ok+"[ \/\135\u003f([\u0030\u002d9\135\053\050\.[\060-\u0039]\u002b\u0029\u003f)");if(pk.exec(gj)!=null){jk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="\107\145c\153o")myAgent="\155o\u007a";} kk();function getEl(name){return document.getElementById(name);}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user