Skip to main content
Participating Frequently
October 9, 2009
Question

How to Test if Stream Exists

  • October 9, 2009
  • 2 replies
  • 4344 views

I am developing an application that needs to test if a stream exists, the logic is as follows:

  • Open a page and my SWF is passed a variable, this will be the stream name
  • Now I want to test if that stream name is publishing
  • If it is, my SWF will open that stream and play it
  • If it is not, it will play a pre-recorded media file

What is the syntax of this check and does it require some server side coding?

Thanks

    This topic has been closed for replies.

    2 replies

    October 19, 2009

    Due to shared setup of our FMIS servers the Admin API is made available to a client on a shared plan is very limited. We will be working a system to allow fully Admin API privileges but for now we feel keep track of all live stream using the onPublish and onUnPublish methods found in the Application class. A solution very similar to the one JayCharles proposed above.

    I have included a sample which I hope anyone checking out this post finds useful.

    Thanks,

    Influxis Support

    NV

    r00tk1llAuthor
    Participating Frequently
    October 20, 2009

    Thank you guys for your help, I was tossing arround ideas with storing the stream names in shared objects, but I would like to give the array a try. My only question is, is this array persistent, even if there are no active streams??

    Participant
    October 26, 2009

    The array is persistent as long as the application instance is load. To check if an application instance is loaded you can do so using the Flash Media Admin Console. Your FMS Admin Console can be accessed via your Influxis Wizard.

    Hope this helps.

    Thanks,

    Noe

    October 9, 2009

    I'm fairly certain the only way to do that is through the getLiveStreams() method of the admin service ( http://help.adobe.com/en_US/FlashMediaServer/3.5_Server_Management_ASD/WS5b3ccc516d4fbf351e63e3d11a0d3ed999-7eb5.html#WS5b3ccc516d4fbf351e63e3d11a0d3edb98-7fe7 ).

    To use it, you can either make a connection to the admin service from your FMS application (some server side programming would be involved), or you can use an HTTP application server (PHP, ASP, etc) to make the request via the admin service HTTP API before you present the .swf to the user.

    r00tk1llAuthor
    Participating Frequently
    October 9, 2009

    If I were to call it from within the SWF, how would I loop through the results of this:

    getLiveStreams(appInst:String) : Object

    Also, here is what I get using the HTTP call
    <result>
    <level>error</level>
    <code>Admin.API.MethodNotAllowed</code>
    <description>getlivestreams - Method not allowed!</description>
    <timestamp>10/9/2009 5:26:46 PM</timestamp>
    </result>

    Is this because I am aVhost admin, instead of the main administrator?
    October 10, 2009

    It's not because you're a vhost admin... it's likely because your admin use doesn't have rights to use that method in users.xml.

    Also, unless the .swf is only being served to trusted people through a secure network, I'd rethink making admin api calls from the .swf. Doing that requires you to expose your admin credentials.