Tuesday, March 8, 2016

Installing screenshare on red5 server

A client of mine asked me to install screenshare on his red5 server and I found very little resources on the subject. After successfully configuring it I decided I will share the solution so that those that come after, will spend less time that I did!!!
So to the task :
I will suppose that you already have a working red5 server. My deployment was on red5-server-1.0.6-RELEASE-server.
Now download screenshare:
Go to https://github.com/deleolajide/red5-screenshare and press "Download Zip".
Inside the zip you will find a directory webapps/screenshare. Extract this screenshare directory to your red5 server's webapps folder.
Inside the screenshare you need to edit two files.
Edit the screenshare.jnlp as follows

<?xml version='1.0' encoding='utf-8'?>
<jnlp spec='1.0+' codebase='http://localhost:5080/screenshare'>
    <information>
        <title>Red5 ScreenShare</title>
        <vendor>Dele Olajide</vendor>
        <homepage>http://code.google.com/p/red5screnshare/</homepage>
        <description>Red5 ScreenShare</description>
        <description kind='short'>An Open Source Screen Share Java application for Adobe Flash using Red5</description>
        <offline-allowed/>
    </information>
    <security>
        <all-permissions/>
    </security>  
    <resources>
    <j2se version='1.6+'/>
        <jar href='screenshare.jar'/>
    </resources>
    <application-desc main-class='org.redfire.screen.ScreenShare'>
        <argument>localhost</argument>
        <argument>screenshare</argument>

        <argument>1935</argument>
        <argument>screen_share</argument> 
        <argument>flashsv2</argument>        
        <argument>10</argument>        
        <argument>1024</argument> 
        <argument>768</argument>         
    </application-desc>
</jnlp>

If you run a public server, replace localhost with your public IP.
Then edit screenviewer.html as follows (some lines are not shown since they do not contain configuration):

...
        var stream = getPageParameter('stream', 'screen_share');
        var url = getPageParameter('url', 'rtmp://localhost:1935/screenshare');
        var control = getPageParameter('control', 'true');
...

If you run a public server, replace localhost with your public IP.
And that is all.
Do not forget to add your site on java security tab or the java client will be blocked:
Then run on one PC (to share):
http://YOUR_PUBLIC_IP:5080/screenshare/screenshare.jnlp
And on the other PC (to view):
http://YOUR_PUBLIC_IP:5080/screenshare/screenviewer.html
Replace  YOUR_PUBLIC_IP with localhost to test on your pc!

P.S.
If you run a server on a public IP, do not forget to open port 1935 on your server's firewall!