noeledoran
12-02-2003, 05:46 PM
Embedded 6.4 Media Player so that player and timer start when a user hits the 2 key. Works finr on some IE, but not NS7. MediaPlayer does not exist according to NS7, but right click on the screen allows me to play the video.
www.mapzap.com/tracetest.php is the link to the code.
code follows
<html>
<head>
<title>Moment to Moment</title>
<SCRIPT LANGUAGE="javaScript">
var $tid=0;
function countDown(){
if ($tid){
clearTimeout($tid);
$tid=0;
}
$ctrstr=document.outform.timer.value;
$timarr=$ctrstr.split(":");
if ($timarr[1]<50){
$timarr[1]++;
$t=$timarr[1];
}else{
return;
}
if ($timarr[1]<=9){$timfil="0";}else{$timfil="";}
document.outform.timer.value=$timarr[0]+":"+$timfil+$timarr[1];
$tid=setTimeout("countDown()",1000);
}
function startit(){
window.document.MediaPlayer.Play();
countDown();
}
</SCRIPT>
</head>
<body>
<table width="100%">
<tr><td align="center">
<H1>Moment to Moment Reactions</H1>
You start the video by depressing the 2 key.<br><br>
</td></tr>
<tr><td align="center">
<?php
$videoUrl="http://www.mapzap.com/IMAGES/sensitiveteeth.asf";
printf('<OBJECT ID="MediaPlayer"
CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">
<PARAM name="autoStart" value="false">
<PARAM name="filename" value="%s">
<PARAM name="playcount" value="1">
<PARAM name="showDisplay" value="false">
<PARAM name="showControls" value="false"
<EMBED TYPE="application/x-mplayer2" width="400" height="323"
PLUGINSPAGE="http://microsoft.com/windows/mediaplayer/en/download/"
ID="MediaPlayer"
NAME="MediaPlayer"
SRC="%s"
SHOWCONTROLS="0"
AUTOSTART="0">
</EMBED>
</OBJECT>',$videoUrl,$videoUrl);
?>
</td></tr>
<tr><td align="center">
<form name="outform">
<input type="hidden" name="mouseval" value=0>
<input type="text" name="timer" value="0:00"><br>
</form>
</td></tr>
<tr><td align="center">
Depress the 2 Key to Start.
</td></tr>
<SCRIPT LANGUAGE="javaScript">
var brow=(navigator.appName.substr(0,3));
var ver = parseInt(navigator.appVersion);
if (brow=="Net"){b="NS";}
if (brow=="Mic"){b="IE";}
if (b=="NS"){document.captureEvents(Event.KEYPRESS)}
document.onkeypress=kpress;
function kpress(e){
if(b=="IE"){key=event.keyCode;}else{key=e.which;}
keyval=String.fromCharCode(key);
if (keyval == 2 ){startit();}
}
</SCRIPT>
<table>
</body>
</html>
www.mapzap.com/tracetest.php is the link to the code.
code follows
<html>
<head>
<title>Moment to Moment</title>
<SCRIPT LANGUAGE="javaScript">
var $tid=0;
function countDown(){
if ($tid){
clearTimeout($tid);
$tid=0;
}
$ctrstr=document.outform.timer.value;
$timarr=$ctrstr.split(":");
if ($timarr[1]<50){
$timarr[1]++;
$t=$timarr[1];
}else{
return;
}
if ($timarr[1]<=9){$timfil="0";}else{$timfil="";}
document.outform.timer.value=$timarr[0]+":"+$timfil+$timarr[1];
$tid=setTimeout("countDown()",1000);
}
function startit(){
window.document.MediaPlayer.Play();
countDown();
}
</SCRIPT>
</head>
<body>
<table width="100%">
<tr><td align="center">
<H1>Moment to Moment Reactions</H1>
You start the video by depressing the 2 key.<br><br>
</td></tr>
<tr><td align="center">
<?php
$videoUrl="http://www.mapzap.com/IMAGES/sensitiveteeth.asf";
printf('<OBJECT ID="MediaPlayer"
CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">
<PARAM name="autoStart" value="false">
<PARAM name="filename" value="%s">
<PARAM name="playcount" value="1">
<PARAM name="showDisplay" value="false">
<PARAM name="showControls" value="false"
<EMBED TYPE="application/x-mplayer2" width="400" height="323"
PLUGINSPAGE="http://microsoft.com/windows/mediaplayer/en/download/"
ID="MediaPlayer"
NAME="MediaPlayer"
SRC="%s"
SHOWCONTROLS="0"
AUTOSTART="0">
</EMBED>
</OBJECT>',$videoUrl,$videoUrl);
?>
</td></tr>
<tr><td align="center">
<form name="outform">
<input type="hidden" name="mouseval" value=0>
<input type="text" name="timer" value="0:00"><br>
</form>
</td></tr>
<tr><td align="center">
Depress the 2 Key to Start.
</td></tr>
<SCRIPT LANGUAGE="javaScript">
var brow=(navigator.appName.substr(0,3));
var ver = parseInt(navigator.appVersion);
if (brow=="Net"){b="NS";}
if (brow=="Mic"){b="IE";}
if (b=="NS"){document.captureEvents(Event.KEYPRESS)}
document.onkeypress=kpress;
function kpress(e){
if(b=="IE"){key=event.keyCode;}else{key=e.which;}
keyval=String.fromCharCode(key);
if (keyval == 2 ){startit();}
}
</SCRIPT>
<table>
</body>
</html>