Skip to main content
April 19, 2011
Question

Issue with allowedHTMLdomains.txt in Live App

  • April 19, 2011
  • 1 reply
  • 2513 views

Hi,

My Purpose is to record live streams on server side and play recorded files later.

What i have done is -

1. Copied All files of applications/live in some safe location.

2. Copied all files from samples/applications/live to applications/live folder. (Deleted main.far from live folder)

3. Restricted SWF and HTML to mydomain in these files - allowedHTMLdomains.txt and allowedSWFdomains.txt

4. In main.asc i added these line in the end

var mystream;
var intervalID;

application.onConnect = function(clientobj)
{
  return true;
}
application.onPublish = function(clientObj,streamObj){
trace("In app pub:");
mystream = Stream.get(streamObj.name);
mystream.onStatus = function(info)
{
     trace("mystream onstatus:"+ info.code);
}
mystream.record();
trace("Got it via FMLE = " + streamObj.name);
}
application.onUnpublish = function(clientObj,streamObj){
mystream.record(false);
}

5. Then i restarted FMS and tried streaming using FLash Media Encoder. I was able to live stream and then i stopped it.

6. A FLV File was recorded in application/live folder with the stream name that i used in encoder.

Now the issues i have, i am able to view live video on my domain as well as some other domain, that means allowedHTMLdomains.txt and allowedSWFdomains.txt did not worked. Another issue is that i am not able to view recorded video after i stopped encoder but i was able see live video before stopping. i am using jwplayer to view the video and using flashvars streamer(rtmp://xx.xx.xx.xxx/live) and file(abc) to view the live and recorded video.

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    April 20, 2011

    Why have you added these lines:

    application.onConnect = function(clientobj)
    {
      return true;
    }

    application.onConnect is already defined in main.asc of live - are you saying you have removed application.onConnect code which was present earlier. If that's the case , allowedHTMLdomains.txt  will not work at all - as you have removed the code which does the check. The way you are doing is accpeting all connections without doing any check.

    April 20, 2011

    ok, now i will remove these lines

    application.onConnect = function(clientobj)
    {
      return true;
    }

    i did not delete any existing code. But application.onConnect was appearing two times due to my code.

    I will try to remove it and will check again. Meanwhile i also want to keep bandwidth cap.

    I read somewhere i should add following code in main.asc -

    -------------

    application.onConnect = function(newClient, serverToClient, clientToServer){
        newClient.setBandwidthLimit(74000, 74000);
        application.acceptConnection(newClient);
    }

    ------------------

    But now it again has application.onConnect, how should i add this function in existing application.onConnect

    Please guide

    Participating Frequently
    April 20, 2011

    Any additional code , you need to put in same function. So your additional code "newClient.setBandwidthLimit(74000, 74000);" should go inside existing application.onConnect. However make sure you change newClient variable name as per your existing function.