Playing videos dynamically

Discussion in 'PHP' started by moin, Apr 24, 2007.

  1. #1
    Hello friends,

    How to write the code for playing videos dynamically, for example, my video file name is video.php?file.mpg

    how to retrieve the file.mpg from the url and play the video in the browser.

    I will be helpful to u.

    Thanks,
     
    moin, Apr 24, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    video.php?play=file.mpg

    
    <?php
    
    $videofolder = './videos/';
    $filename = $_GET['play'];
    
    if (!preg_match('/\.(mpe?g|wmv|avi)$/i', $filename) OR !file_exists($videofolder . $filename))
    {
         exit();
    }
    
    ?>
    
    <embed src="<?php echo $videofolder . $filename; ?>" autostart="false" />
    
    
    PHP:
     
    nico_swd, Apr 24, 2007 IP
  3. pauldp

    pauldp Active Member

    Messages:
    108
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    thank you , nico_swd
     
    pauldp, Apr 24, 2007 IP