Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Member webmastercorey's Avatar
    Join Date
    Nov 2005
    Location
    Kansas
    Posts
    49
    Member #
    11909
    Hi I have this scrip where I automatically display video into a table. I was wondering if anyone knew how to make it so this script could automatically spit out the duration of each video.

    PHP Code:

    <?php
    ini_set 
    ('display_errors''0');
    ini_set ('register_globals''1'); 

    $i 0;

    $current_dir "videos/";
    $dir opendir($current_dir);
    while( 
    $file readdir($dir) )

         
    //exclude all items that you don't want to display
        
    if( ($file=='.')
            ||(
    $file=='..')
            ||(
    $file=='_vti_cnf')
            ||(
    $file=='latestvideo')
            ||(
    $file=='thumbnails')


        ) continue;

        
    $pieces explode("|""$file");
        
    $tmp explode"."$pieces[2] );
        
    $dt[$i] = $tmp[2] * 10000 $tmp[0] * 100 $tmp[1];
        
    $arr[$i] = $file;
        
    $i++;
    }
    closedir($dir); 

    // Sort by 'dt'
    array_multisort$dtSORT_DESC$arr );

    echo 
    "<table border=\"0\" width=\"320\" align=\"center\">";

    foreach (
    $arr as $val)
    {
        
    $pieces explode(".""$val");
        echo 
    "
        
    <tr><td width=\"400\">


    <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">
    <tr>
    <td rowspan=\"2\" width=\"50%\">
    <a href=\"http://www.mkcproductions.com/videos/
    $pieces[0].mpg\" title=\"$pieces[0]\" rel=\"enclosure\" onclick=\"window.open('http://www.joshkinberg.com/popup.php?url='+this.href,'video','width=350,height=286,top=20,left=20,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=yes,left=0,top=0');return false\">
    <img border=\"0\" src=\"videos/thumbnails/
    $pieces[0].jpg\" width=\"130\" height=\"98\" style=\"border: 1px solid #FFFFFF\"></a></td>
    <td valign=\"top\" width=\"50%\">
    <div align=\"center\">
    <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
    <tr>
    <td>
    <p align=\"left\"><font size=\"5\">
    $pieces[0]</font></td>
    </tr>
    <tr>
    <td><font color=\"#00FF00\">Duration:</font>  min  sec</td></tr>
    </table>
    </div>
    </td>
    </tr>
    <tr>
    <td width=\"50%\">
    <div align=\"center\">
    <table border=\"0\" width=\"100%\" cellpadding=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#990000\">
    <tr>
    <td style=\"border-right-style: none; border-right-width: medium\" width=\"68\">
    <input type=\"button\" value=\"PLAY VIDEO\" href=\"http://www.mkcproductions.com/videos/
    $pieces[0].mpg\" title=\"$pieces[0]\" rel=\"enclosure\" onclick=\"window.open('http://www.joshkinberg.com/popup.php?url='+this.href,'video','width=350,height=286,top=20,left=20,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=yes,left=0,top=0');return false\"  style=\"float: left\"></td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    </table>
    <hr noshade color=\"#990000\">

    </td>
    </tr>
    "

    }
    echo 
    "</table>";
    ?>
    Thanks for your help,
    Corey
    "What good will it be for a man if he gains the whole world, yet forfeits his soul?"
    -Matthew 16:26

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You would need:
    • To know the format of the video
    • Some sort of program or PHP module that can read said format and give you its duration

    I don't believe PHP can do either with any of its included modules. However, if you're hosted on Windows and have a dedicated server (not shared), you're in luck: you could write your own program or DLL in C# or some other native language, and access it using PHP. It should be reasonably simple to do so.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:20 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com