Video streaming using flowplayer
By Syed Asim Abbas
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
Date : 10-May-2010
The purpose of this document is to create a web streaming using apache,php and flowplayer. Streaming is not a rocket science
just add flowplayer in your code and enjoy .flv based video streaming server.
Required packages
----------------
Mysql (User choice if you waana use it ok go with mysql or you can do streaming without mysql it is totally depand upon your requirment)
Apache
flowplayer
php-5
[root@fileserver ~]# rpm -qa |grep mysql
libdbi-dbd-mysql-0.8.1a-1.2.2
mysql-5.0.22-2.1
mysql-bench-5.0.22-2.1
pam_mysql-0.7-0.4.rc1
mysql-devel-5.0.22-2.1
mod_auth_mysql-3.0.0-3.1
mysql-server-5.0.22-2.1
mysql-connector-odbc-3.51.12-2.2
php-mysql-5.1.6-5.el5
[root@fileserver ~]# rpm -qa |grep http
jakarta-commons-httpclient-3.0-7jpp.1
httpd-2.2.3-6.el5.centos.1
system-config-httpd-1.3.3.1-1.el5
httpd-manual-2.2.3-6.el5.centos.1
[root@fileserver ~]# rpm -qa |grep php
php-cli-5.1.6-5.el5
php-5.1.6-5.el5
php-mysql-5.1.6-5.el5
Download flowplayer opensource version it is free of coast for comercial use under GPL.
[root@fileserver ~]# wget http://releases.flowplayer.org/flowplayer/flowplayer-3.2.0.zip
root@fileserver ~]# unzip flowplayer-3.2.0.zip
Archive: flowplayer-3.2.0.zip
[root@fileserver flowplayer]# ls
example flowplayer-3.2.0.swf flowplayer.controls-3.2.0.swf LICENSE.txt README.txt
ok we got the player now first configure mysql
[root@fileserver flowplayer]# /etc/init.d/mysqld start
[root@fileserver flowplayer]# mysql -u root -p
Enter password:
mysql> create database videos;
Query OK, 1 row affected (0.13 sec)
mysql> GRANT CREATE, SELECT, INSERT, DELETE ON videos .* TO asim@'localhost' IDENTIFIED BY 'redhat';
Query OK, 0 rows affected (0.06 sec)
mysql> use videos;
Database changed
mysql> CREATE TABLE `video` (
-> `video_id` int(11) NOT NULL auto_increment,
-> `video_tag` text NOT NULL,
-> `uploaddate` datetime NOT NULL default '0000-00-00 00:00:00',
-> `hits` text NOT NULL,
-> `activestatus` varchar(10) NOT NULL default '',
-> `video_name` varchar(200) NOT NULL default '',
-> `video_title` text NOT NULL,
-> PRIMARY KEY (`video_id`)
-> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
Query OK, 0 rows affected (0.10 sec)
mysql> INSERT INTO `video` VALUES (1, 'Paranormal Activities', '2010-04-12 00:00:00', '4', '1', '1.flv', 'Great Movie with low budget');
Query OK, 1 row affected (0.10 sec)
mysql> INSERT INTO `video` VALUES (2, 'Clash of Titans', '2010-04-13 00:00:00', '15', '1', '2.flv', 'Average Movie');
Query OK, 1 row affected (0.01 sec)
Now After Database create index page in /var/www/html/stream
[root@fileserver ~]# cd /var/www/html/stream/
create folder js or as per your code
[root@fileserver stream]# mkdir js
Now copy flowplayer file into js folder or as per your code path
[root@fileserver stream]# cp /root/flowplayer/flowplayer-3.2.0.swf /root/flowplayer/example/flowplayer-3.2.0.min.js js/
My index.php is display below create your own. Add the following flowplayer lines on you index
[root@fileserver stream]# cat index.php
flowplayer("player", "js/flowplayer-3.2.0.swf");
Also create anonther folder video or as per your code.
[root@fileserver stream]# mkdir video
copy all videos into video folder.
Restart mysqld & httpd
[root@fileserver stream]# service mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
[root@fileserver stream]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
now open browser and type
http://192.168.1.249/stream/index.php
Thanks to Allah. It is working
CHEERS :)