tags:

views:

197

answers:

3

Dear all, i want to play most of all video files in browser, is it possible? can any buddy help me out.

thanks in advance.

+1  A: 

PHP is a server-side programming language for dynamically generating content. This will not help you play videos for the end-user. For that, you will either need to stream the video and count on the user having a plugin, or you will need to use some sort of end-user video player, perhaps using Flash. PHP isn't really what you're looking for here, as it just generates content to send to the browser.

avpx
so it is not possible through php ?
chirag
Well, no, it is, but you're looking at the wrong layer of the process. PHP doesn't play the video. The most it can do is provide content to the browser (in this case). PHP runs on the webserver and generates content. If you want the browser to do something with that content, that's not PHP's domain.
avpx
A: 

I assume you're talking about a web server, and you want all of them to appear in your browser window?

You're going to need a JavaScript or Flash video player to play the files in the browser. Some that I've used in the past are http://flowplayer.org/ and http://ajaxian.com/archives/jsonvid-pure-javascript-video-player

You probably want to use PHP, if you're going to use PHP, to list all the video files on your server (which I am assuming is Linux). You're going to want to use UNIX utilities instead of building your own, I'd imagine; probably a recursive find command. So your PHP code will look something like:

<?php
$files = `find BASE_DIRECTORY -name *.FILE_EXTENSION`;
foreach ($files as $file)
{
    // Display viewer
}
?>
Jason B
+1  A: 

At work we do just this. Assuming that you're talking about a webserver, it's pretty easy to set up. I second the earlier recommendation of flowplayer from http://www.flowplayer.org.

Load your videos into a webserver-accessible directory, generate a list of them with php, and use that list to activate the flowplayer, which can be controlled with javascript.

monksp
all videos are uploaded by users so i have to generate that list dynamically ?? or no need to do this, i don't have much experience of flow player so i am confusing little bit, is it play all videos on browser?
chirag
If you setup a database to take on the role of file indexer you can easily allow for searching, indexing, display and browsing of videos that were uploaded to your server. Furthermore, by using a database you can have PHP, or whatever other back-end language you use, to dynamically generate those playlists for FlowPlayer.
drlouie - louierd
Flowplayer is a flash program that plays videos, and it's pretty easy to use.You'll have to generate the list dynamically. I use php to generate a page of video file names, then use the jquery javascript library to make a menu from that.
monksp
i want to play these types of videos vob, avi, mpeg, wmv,dat,3gp,flv etc.. is it possible with flowplayer ??
chirag
flowplayer supports any file type that flash in general supports. flv, mp4 I know for sure. Dunno about others.
monksp