+ Reply to Thread
Results 1 to 7 of 7

Thread: quicktime crossbrowser javascript time display

  1. #1
    Full Member smok3 is on a distinguished road
    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)

  2. #2
    Full Member smok3 is on a distinguished road
    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>

  3. #3
    Full Member smok3 is on a distinguished road
    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)

  4. #4
    Full Member Marshall is on a distinguished road
    Join Date
    May 2004
    Posts
    69
    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.

  5. #5
    Full Member Marshall is on a distinguished road
    Join Date
    May 2004
    Posts
    69
    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.

  6. #6
    Full Member smok3 is on a distinguished road
    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?

  7. #7
    Full Member Marshall is on a distinguished road
    Join Date
    May 2004
    Posts
    69
    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts