PDA

View Full Version : quicktime and WMP detection problems



riptide
05-08-2007, 03:26 PM
I have two scripts one for Windows media player and one for Quicktime. the one for QT I can't seem to get to work. also I'm wondering why I can't call the function for WMP though the QT function.


</script>

<!--WMP function-->

<script language="JavaScript">
function testForWMP(){
var player;
var plugin;
var hasActiveX=false;

try{
if(window.ActiveXObject)
{
hasActiveX = true;
player = new ActiveXObject("WMPlayer.OCX.7");
}
else if (window.GeckoActiveXObject)
{
hasActiveX = true;
player = new GeckoActiveXObject("WMPlayer.OCX.7");
}
} catch(oError) { }
try {
if(navigator.mimeTypes)
{
plugin = navigator.mimeTypes['application/x-mplayer2'].enabledPlugin;
}
}catch (oError) { }
var message = "Your browser "+ (hasActiveX ? "does" : " does not") +" support ActiveX. \n";
message += "The Windows Media Player ActiveX control is"+ ( player ? "" : " not") +" installed. \n";
message += "The Windows Media Plugin "+ (plugin ? "is" : "is not") +" installed. \n";
alert(message);
}
</script>

</head>

<body>

<div id="video"> "Klick to start video"
<img src="http://www.knallgrau.at/code/plugin_js/demo/video-embeding/img/skifoan.jpg"
width="352" height="288" alt="Preview image for video; Klick to start video."

longdesc="http://www.knallgrau.at/code/plugin_js/demo/video-embeding" /></a></div>

<script type="text/javascript"><!--
function startVideo() {
if (Plugin.isInstalled("QuickTime")) {
var quickTime = Plugin.getInfo("QuickTime");
if (parseInt(quickTime.version) == 6 &&
quickTime.version.indexOf("6.5") == 0 || parseInt(quickTime.version) >= 7) {alert("you have quicktime")

return false;
}


}


} else {testForWMP()/*can't tell if this works*/

return false;
}
}
return false;
}
// --></script>

<!--javascript for second quticktime navigator-->

<script language="Javascript">
var haveqt = false;


if (navigator.plugins) {
for (i=0; i < navigator.plugins.length; i++ ) {
if (navigator.plugins[i].name.indexOf("QuickTime") >= 0)
{ haveqt = true; }
if (haveqt==true)
{alert("you have qt")}
}
}
// — >
</script>

riptide
05-08-2007, 10:33 PM
do I need to show the site's I got the code off of

riptide
05-09-2007, 01:49 PM
http://www.streamingmedia.com/article.asp?id=8584&page=2&c=4
that one is for the windows media player


http://www.knallgrau.at/code/plugin_js
the demo video JS for quicktime.