How to setup Video Streaming server for hosting accounts
Today I would like to explain you the methods to setup video streaming software and a method to provide it to the customers. First of all we need to select a powerful and stable video streaming server application. I recommend Wowza media server even though it is not free. But it is quite stable and can handle large number of connections without any trouble.
Please wait while we retrieve data from server .............
Please make sure you have installed java in the server. Download Wowza media server from the link given below.
{codecitation}wget http://www.wowzamedia.com/downloads/WowzaMediaServer-1-7-2/WowzaMediaServerPro-1.7.2.rpm.bin {/codecitation}
After that change the permission of the binary and execute the binary
{codecitation}chmod +x WowzaMediaServerPro-1.7.2.rpm.bin
./WowzaMediaServerPro-1.7.2.rpm.bin {/codecitation}
Then start the server as follows.
{codecitation} cd /usr/local/WowzaMediaServerPro/bin
./startup.sh{/codecitation}
Then you need to provide the serail number for Wowza server to start properly.
After that you can start, stop and restart the server as follows.
{codecitation} /etc/init.d/WowzaMediaServerPro start
/etc/init.d/WowzaMediaServerPro stop
/etc/init.d/WowzaMediaServerPro restart{/codecitation}
Now you can test whether wowza is running properly using the link given below.
{codecitation} http://<ip>:1935{/codecitation}
If you need to change the port or assign it to a particular ip, you can change it in the file given below.
{codecitation}/usr/local/WowzaMediaServerPro/conf/VHost.xml
<IpAddress>ip of the server</IpAddress>
<Port>80</Port>{/codecitation}
After that restart the server.
Now we can test the application with some samples. First copy the example application to a place where we can access the content through webserver. For example if you are using cpanel, copy /usr/local/WowzaMediaServerPro/examples/SimpleVideoStreaming to /usr/local/apache/htdocs/ or /var/www/html for a simple apache server.
Then simple create a empty folder "/usr/local/WowzaMediaServerPro/applications/simplevideostreaming" and copy the xml file from /usr/local/WowzaMediaServerPro/conf/Application.xml to /usr/local/WowzaMediaServerPro/conf/simplevideostreaming/Application.xml
Restart the Wowza server. Now the default content location for this video streaming is
{codecitation}/usr/local/WowzaMediaServerPro/content/{/codecitation}
Now you can check the video streaming as follows.
{codecitation}http://<ip of apache server>/SimpleVideoStreaming{/codecitation}
You can see the file section already filled with "Extremists.m4v" that is present in the "/usr/local/WowzaMediaServerPro/content/". If you need to test with any other video you can check it by uploading to /usr/local/WowzaMediaServerPro/content/.
Also if you are using any other ip, you need to specify that in the server text box instead of localhost ie replace "rtmp://localhost/simplevideostreaming" with "rtmp://<ip of server>/simplevideostreaming"
Now we are moving to advanced configurations. First we need to change the location of the content folder so that we can give it for hosting purpose. There are two ways one is to give each storage folder for each customer account seperately. I am using a easy method. In this we are going to give storage location as "/home" in /usr/local/WowzaMediaServerPro/conf/simplevideostreaming/Application.xml
After that we can download the JWplayer from their site "http://www.longtailvideo.com/players/jw-flv-player/"
I am pasting the embedded code for the Wowza rtmp streaming below.
{codecitation}
<script type='text/javascript' src='swfobject.js'></script>
<!--<script type="text/javascript" src="http://www.longtailvideo.com/jw/embed/swfobject.js"></script> -->
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
var so = new SWFObject('http://<ip of apache server>/mediaplayer/player.swf','mpl','470','290','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('file','user/public_html/mediaplayer/video.flv');
so.addVariable('streamer','rtmp://<ip for Wowza>/simplevideostreaming');
so.write('mediaspace');
</script>
{/codecitation}
Create a html page and paste the code given above in it. If there is any error in javascript, download the javascript from "http://www.longtailvideo.com/jw/embed/swfobject.js" and test again.
Then take it using the browser, you can see the video playing :) Also you can create other domain accounts and instruct them to use the same settings given above and change the location of file folder after giving the jwplayer folder to them :)
Hope this article helps you and add comments if you have any doubts