Play videos from folder on server

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
manRay
Forum Commoner
Posts: 78
Joined: Mon Feb 09, 2009 1:57 pm

Play videos from folder on server

Post by manRay »

Can anyone recommend a way to play videos/audio files? I have looked all over the place, and it seems this is the only place where I can get reasonable answers. I have a website where users can upload videos and audio files to a specific folder. When the user logs on these files are links, and open up in a new window, this is a nuisance considering if the user wants to listen to many songs or watch multiple videos. My question is has anyone come across a a way to fix this. I know there is flash player, but I cant find any resources to tell me how to install!
ldougherty
Forum Contributor
Posts: 103
Joined: Sun May 03, 2009 11:39 am

Re: Play videos from folder on server

Post by ldougherty »

What type of server is your site hosted on, Windows or Linux and is it a shared or private server? The answer to these questions will let people know what your likely hosting limitations could be.

The best bet generally for speed is to link the audio and video clips as you were stating. If the server has the correct mime types then the files will be opened in the correct application.

For reference you can use our listing of mime types on a Windows server.

http://www.hostmysite.com/support/dedic ... _source=bb
manRay
Forum Commoner
Posts: 78
Joined: Mon Feb 09, 2009 1:57 pm

Re: Play videos from folder on server

Post by manRay »

It is a linux server, I dont knwo how to find out if it is shared or private..I am using webhostingpad to host my site.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Play videos from folder on server

Post by John Cartwright »

Your best bet is to convert the videos to a widely supported supported (and compressed format), such as FLV, during the upload. This can be accomplish with a program such as FFMPEG. From there it is a simple matter of using one of the many freely available flash players.
manRay
Forum Commoner
Posts: 78
Joined: Mon Feb 09, 2009 1:57 pm

Re: Play videos from folder on server

Post by manRay »

How can I do it automatically, on upload.?do I have to add a script? I've considered it, but never understood how to implement it.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Play videos from folder on server

Post by John Cartwright »

After installing FFMEG and correclty configuring it, you could make an exec() call similiar to

Code: Select all

exec('ffmpeg -y -i /path/to/original/video.avi -acodec mp3 -f flv /path/to/converted/video.flv');
Feel free to read the documentation though.
Post Reply