 |
 |
 |
 |
December 2nd, 2004, 02:21 PM
|
#1
|
|
Registered User
Join Date: Jul 2004
Posts: 10
|
quicktime crossbrowser javascript time display
ok, i was playing with some code to embed the qt video and display time position next to it, but it gets to complicted when one would need crossbrowser solution, so i wonder if somebody has done something like that?
(i just need curent time displayed as hh:mm:ss:ff or at least in miliseconds mmmm, and the lenght of the movie would come in handy as well - should work in ie6 and firefox 1.0)
|
|
|
December 6th, 2004, 01:49 AM
|
#2
|
|
Registered User
Join Date: Jul 2004
Posts: 10
|
this is an example of the code that is bork and kinda works in ie (with error):
Code:
<html><head><TITLE></TITLE></head>
<body bgcolor=black>
<center>
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="90%" height="90%" id="filmck" name="filmck">
<param name="src" value="slovenija_mpeg4.mov" />
<param name="controller" value="true" />
<param name="controller" value="true" />
<param name="scale" value="aspect" />
<EMBED SRC="slovenija_mpeg4.mov" WIDTH="90%" HEIGHT = "90%" AUTOPLAY="true" CONTROLLER="true" LOOP="true" scale="ASPECT" bgcolor="000000" enablejavascript="true" id="filmck" name="filmck">
</EMBED>
</object>
<!--
<a href="#" onclick="document.filmck.Play()">Play</a>
<a href="#" onclick="document.filmck.Stop()">Stop</a>
-->
<form action="" name="formular2"><font size="-1">
<input type="text" name="clipPosition" size="10" readonly> <br>
</form>
</center>
<script language="JavaScript">
<!--
function startCheckPlayer() {
window.setTimeout("checkPlayer()",100);
window.setInterval("checkPlayerStatus()",100);
}
function checkPlayerStatus() {
document.formular2.clipPosition.value = parseInt(document.filmck.GetTime() / document.filmck.GetTimeScale()*1000);
}
window.setTimeout("checkPlayer()",100);
window.setInterval("checkPlayerStatus()",100);
-->
</script>
<script language="JavaScript">
window.setTimeout("startCheckPlayer()",2500);
</script>
</body>
</html>
|
|
|
December 14th, 2004, 12:19 PM
|
#3
|
|
Registered User
Join Date: Jul 2004
Posts: 10
|
and here is the latest version, kinda php enhanced (should work for most users in ie6 and firefox1):
PHP Code:
<html><head>
<TITLE><? echo $_GET['moviename']; ?></TITLE>
<!--
passing url must be constructed as for example:
[url]http://somestuff.org/tmp/qt.php?moviename=somemovie.mov[/url]
-->
<style type="text/css">
body, td
{
font-size: 10pt; font-family: arial;
margin-top: 20px;
}
.timecode
{
border-style:solid; border-width:0pt; font-size: 10pt; background-color:transparent;
}
</style>
</head>
<body bgcolor="#808080" onLoad="starttimer()">
<center>
<object width="90%" height="90%"
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="filmck">
<param name="src" value="<? echo $_GET['moviename']; ?>">
<param name="autoplay" value="true">
<param name="controller" value="true">
<param name="loop" value="true">
<param name="scale" value="aspect">
<param name="bgcolor" value="#808080">
<EMBED SRC="<? echo $_GET['moviename']; ?>" WIDTH="90%" HEIGHT = "90%" AUTOPLAY="true" CONTROLLER="true" LOOP="true" scale="ASPECT" bgcolor="#808080" name="filmck" PLUGINSPAGE="http://www.apple.com/quicktime/download/">
</embed>
</object>
<form action="" name="formular2" id="formular2">
<input type="text" name="clipPosition" size="10" class="timecode">
</form>
</center>
<script language="JavaScript">
<!--
function checkPlayerStatus()
{
document.formular2.clipPosition.value = parseInt(document.filmck.GetTime() / document.filmck.GetTimeScale() * 1000);
}
function starttimer()
{
window.setInterval("checkPlayerStatus()",100);
}
-->
</script>
</body>
</html>
(and dont be shy, any comments are welcome - especially if one is to test and debug this thingy..., my js knowhow is really low iam afraid)
|
|
|
December 14th, 2004, 05:46 PM
|
#4
|
|
Registered User
Join Date: May 2004
Posts: 70
|
Using $_GET['moviename'] in the src for those is VERY VERY BAD. If someone put in moviename=../../../etc/passwd or any other system file it would use that as the src. Use something like
Code:
$moviename = trim(htmlspecialchars($_GET['moviename']));
and then use $moviename for the src's.
|
|
|
December 14th, 2004, 06:05 PM
|
#5
|
|
Registered User
Join Date: May 2004
Posts: 70
|
Ugh sorry had a brainfart, thats not for removing those kinda things, use something like
Code:
$moviename = trim(str_replace("//", "/", str_replace("..", "", stripslashes(urldecode($_GET['moviename'])))))
to get rid of it to make it more secure.
|
|
|
December 15th, 2004, 02:47 AM
|
#6
|
|
Registered User
Join Date: Jul 2004
Posts: 10
|
ic marshall, tnx for this security tip, how about js part, any ideas on how to make this more browser friendly?
|
|
|
December 15th, 2004, 05:46 PM
|
#7
|
|
Registered User
Join Date: May 2004
Posts: 70
|
Im not very good with javascript but if you test em in different browsers like IE, Opera, Firefox, etc. and it works in all of em then there shouldnt be anything to worry about compatabilitywise 
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:44 PM.
|
|
 |
 |
 |
 |
|