is this even possible?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danwguy
Forum Contributor
Posts: 256
Joined: Wed Nov 17, 2010 1:09 pm
Location: San Diego, CA

is this even possible?

Post by danwguy »

So here's what I would like to do, not sure if it's possible or not but any help would be appreciated. I have a butt ton of movies on my computer(yes I own them all, just using computer hooked to tv because it's easier than switching dvd's), and I set up IIS with php. I would like to <embed> the video files from a folder on a page so that I can go anywhere and play them on my laptop, regardless where in the world I am. I have this so far...

Code: Select all

<?php
$dir = realpath('videos');

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
        		$ext = substr(strrchr($file, '.'), 1);
        			if($ext == "avi") {
            echo "<object data='videos/$file' type='video/avi' /><br />";
        } else {}
        }
        closedir($dh);
    }
}
?> 
it's showing the right path when I right click on page and select view source, but the video will not play. when windows media player pops up, it says it cant play the file. I right click on the name of the file in the playlist and it shows the path as "http://localhost/videos/video.avi" so I am not sure why they are not playing. Any ideas? please? Also if you think this is completely unfeasable for a regular sized (700mb) video file, please let me know.
Post Reply