MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Reference
MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Reference

MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Reference

Server management actionscript language reference

Advertisement

Quick Links

Server Management ActionScript
Language Reference

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE

  • Page 1 Server Management ActionScript Language Reference...
  • Page 2 Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally.
  • Page 3: Table Of Contents

    Contents Server Management ActionScript Language Reference ..5 Using the Server Management ActionScript API ....5 Establishing the connection to the server .
  • Page 4 getServerStats() ..........47 getServices() .
  • Page 5: Server Management Actionscript Language Reference

    Server Management ActionScript Language Reference Macromedia Flash Media Server includes a set of advanced methods, the Server Management ActionScript application programming interface (API), that lets you extend the management console or make your own administration and monitoring tools by creating Macromedia Flash applications.
  • Page 6 To prevent unauthorized users from accessing the administration server, you should use a firewall and limit access to the administration server port (port 1111). For more information about security for Flash Media Server, see the security white papers at www.macromedia.com/ go/flashmediaserver_security_en. Syntax example To make a Server Management ActionScript API call, you’ll want to include a callback...
  • Page 7: A Simple Application Example

    A simple application example This section contains the code for a simple Flash application that calls the getAppStats method. You can copy and paste this code into Flash to see how a simple call works. In Flash, create an application with the following elements: An input field named Application Name with a border A button that calls the method (shown in the code sample that...
  • Page 8 if (arguments.length < 2) { trace("ERROR! you need to supply a text object to output to"); return; if (arguments.length < 3) tabLevel = 0; for (var prop in obj) { for (var i = 0; i < tabLevel; i++) // insert requested # of tab characters destination.text += "\t";...
  • Page 9: Information Objects

    Information objects All Server Management ActionScript API methods return data in an information object with the following properties: , and . All level code timestamp data description details information objects have , and properties. Some methods have the level code timestamp property, which contains return data (often in an object or array), and the data...
  • Page 10 Some methods are available only to server administrators, as indicated by an asterisk (*) in the description of each method; virtual host administrators cannot use these methods. In some cases, virtual administrators can use a method with restrictions; these restrictions are described in the dictionary entry for the method.
  • Page 11 Method Description Returns detailed information about a live stream. getLiveStreamStats() Returns server TCMessage cache statistics. getMsgCacheStats() Returns a list of all network streams that are currently connected getNetStreams() to the application. Returns detailed information about a specific network stream. getNetStreamStats() Returns detailed information about a recorded stream.
  • Page 12 Commands for managing the server The following table lists the methods you can use to manage the server. Method Brief description Adds an administrator to the system.* addAdmin() Adds a new application. addApp() Adds an alias to a virtual host. addVHostAlias() Changes the password for an administrator in the system.
  • Page 13: Addadmin()

    addAdmin() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage addAdmin(admin_name, password [,scope]) Parameters A string that contains the user name of the administrator being added. admin_name Password of that administrator. The password is encoded before it is written to password the Server.xml configuration file.
  • Page 14: Addapp()

    Example The following three examples show how you can specify parameters in a call to the addAdmin command: /* Adds a server administrator named "GLee" with password "boat4907" */ nc.call("addAdmin", new onAddAdmin(), "GLee", "boat4907", "server"); /* Adds a virtual host administrator named "ChrisM" with password "tree2981" nc.call("addAdmin", new onAddAdmin(), "ChrisM", "tree2981");...
  • Page 15: Addvhostalias()

    Example The following example shows a call to add the application to the connected virtual ChatApp host: nc = new NetConnection(); nc.connect("rtmp://localhost:1111/admin", "JLee", "x52z49ab"); nc.call("addApp", new onAddApp(), "ChatApp"); addVHostAlias() Availability Flash Player 6. Flash Media Server 2. Usage addVHostAlias(VHostName, AliasName, PersistValue) Parameters A string indicating the virtual host to which to add an alias.
  • Page 16: Approvedebugsession()

    approveDebugSession() Availability Flash Player 6. Flash Media Server 2. Usage approveDebugSession(appInst, PIN) Parameters A string indicating the application and instance name that has a pending debug appInst connection to approve. A number indicating the debug session Personal Identification Number. Each debug connection issues a debug number when queueing to connect to an application.
  • Page 17: Changepswd()

    The following is an example of a Debug approval request: nc_admin.call("approveDebugSession", null, appName/instName", 1234); changePswd() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage changePswd(admin_name, password [, scope]) Parameters A string that contains the name of the administrator whose password is being admin_name changed.
  • Page 18: Gc()

    Example /* Change password for server administrator named "ASilva" to "cbx5978y" */ nc.call("changePswd", new onChangePswd(), "ASilva", "cbx5978y", "server"); /* Change password for virtual host administrator named "JLee" to "kbat3786" nc.call("changePswd", new onChangePswd(), "JLee", "kbat3786"); /* Change password for virtual host administrator "JLee" to "kbat3786" on */ /* virtual host "tree.oak.com"...
  • Page 19: Getactiveinstances()

    getActiveInstances() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getActiveInstances([processID]) Parameters A number; the process identifier of a Flash Media Server core process. This processID parameter is optional. Returns If the call succeeds, the server sends a reply information object with a property of level property of...
  • Page 20: Getadmincontext()

    Returns If the call succeeds, the server sends a reply information object with a property of level property of , and a property that is an status code NetConnection.Call.Success data array of strings containing the names of all the adaptors. Description Returns an array of adaptors that are defined.
  • Page 21: Getadmins()

    Description Gets the administrative context for an administrator, including information about the specified user’s administrative permissions, the name of the adaptor and virtual host to which the user is connected, and whether the user is currently connected to Flash Media Server. getAdmins() Availability Flash Player 6.
  • Page 22: Getapps()

    getApps() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getApps() Parameters None. Returns If the call succeeds, the server sends a reply information object with a property of level property of , and a property that is an status code NetConnection.Call.Success...
  • Page 23 Returns If the call succeeds, the server sends a reply information object with a property of level property of , and a property that is an status code NetConnection.Call.Success data object. The object has the following properties: data Property Description Number;...
  • Page 24: Getconfig()

    Property Description Number; total number of instances that have been unloaded total_instances_unloaded since the application started. Number; time, in seconds, the application has been running. up_time If the call fails, the server sends a reply information object with a property of level error and a...
  • Page 25 Flash Media Server has four server configuration files: Server.xml, Adaptor.xml, Vhost.xml, and Application.xml. Depending on your permissions, you can get configuration keys for all these files, as described in the following list: For the Server.xml file, specify as the first subkey. All subsequent keys Admin Server correspond to tags that are relative to the...
  • Page 26 Returns If the call succeeds, the server sends a reply information object with a property of level property of , and a property that is an status code NetConnection.Call.Success data XML string for the specified tag. If the call fails (that is, if the specified configuration key isn’t found), the server returns an empty string.
  • Page 27: Getconfig2()

    // Find key in Vhost.xml. key = "Adaptor:_defaultRoot_/VirtualHost:_defaultVhost_/RecordAccessLog"; nc.call("getConfig", new onGetConfig(), key, "/"); // Find key in Application.xml for an application on the virtual host you // connected to when you logged on to the administration server. // Note that the previous subkeys and the second parameter "/" are not necessary.
  • Page 28 Flash Media Server has six server configuration files: Server.xml, Users.xml, Logger.xml, Adaptor.xml, Vhost.xml, and Application.xml. Depending on your permissions, you can get configuration keys for all these files, as described in the following list: "/" specifies Server.xml. "Users" specifies Users.xml for server administrators. "Logger"...
  • Page 29 Description Gets information for the specified configuration key in a specified configuration file. Flash Media Server has six server configuration files: Server.xml, Users.xml, Logger.xml, Adaptor.xml, Vhost.xml, and Application.xml. Virtual host administrators can view configuration keys in the Vhost.xml file and Application.xml files for their own virtual hosts.
  • Page 30: Getgroupmembers()

    tSocket.call("getConfig2", new onGetConfig(), key, scope); // return the whole Vhost.xml key = ""; scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_"; tSocket.call("getConfig2", new onGetConfig(), key, scope); See also getAdminContext() setConfig2() getGroupMembers() Availability Flash Player 6. Flash Media Server 2. Usage getGroupMembers(app_instance, groupNumber) Parameters A string that contains the name of the instance of the application on which app_instance the group resides, in the form .
  • Page 31: Getgroupstats()

    getGroupStats() Availability Flash Player 6. Flash Media Server 2. Usage getGroupStats(app_instance, groupNumber) Parameters A string that contains the name of the instance of the application on which app_instance the group resides, in the form . You must specify both application_name/instance_name the application name and the instance name, separated by a slash ( ), even if you want performance statistics for the default instance of the application.
  • Page 32: Getgroups()

    Property Description Array; an array of numbers (stream IDs). stream_ids Number; the number of clients multiplexing on this group connection. members_count Description Gets statistics for a particular group connection. This connection is special because it multiplexes for more than one connection and contains a unique statistic called .
  • Page 33: Getinstancestats()

    Description Returns a list of the group connections for a particular application instance. Groups are multiplexed connections from a remote edge server to an origin server. Each group connection represents at least one individual connection to another Flash Media Server server that is acting as proxy for this server.
  • Page 34 Property Description Number; total number of messages dropped by this instance of the msg_dropped application. Number; total number of bytes read by this instance of the bytes_in application. Number; total number of bytes written by this instance of the bytes_out application.
  • Page 35: Getiostats()

    If the call fails, the server sends a reply information object with a property of level error and a property of or a more specific value, if available. code NetConnection.Call.Failed Some objects might also have a property that contains a string describing the description cause of the failure.
  • Page 36: Property Description

    Property Description Number; number of currently active socket connections to the connected adaptor. Number; total number of socket connections to the adaptor since total_connects the adaptor was started. Number; total number of socket disconnections from the adaptor. total_disconnects Number; total number of messages dropped. msg_dropped Number;...
  • Page 37: Getlicenseinfo()

    getLicenseInfo() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getLicenseInfo() Parameters None. Returns If the call succeeds, the server sends a reply information object with a property of level property of , and a property that is an status code NetConnection.Call.Success...
  • Page 38 Property Description Number; maximum number of socket connections allowed, which is max_connections determined by license family. If you have more than one license, this number is the sum of the values of all your licenses. max_connections Number; maximum number of adaptors (network cards) that you can max_adaptors configure for the server, which is determined by license family.
  • Page 39: Getlivestreams()

    Description Retrieves complete license information including information on the maximum bandwidth and maximum number of connections, adaptors, virtual hosts, and CPUs that are allowed by the license. License information for all your licenses is first summarized, followed by specific information about each license. getLiveStreams() Availability Flash Player 6.
  • Page 40: Getlivestreamstats()

    getLiveStreamStats() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getLiveStreamStats(app_instance, stream_name) Parameters A string that contains the name of the instance of the application, in the app_instance form application_name/instance_name A string that contains the name of the stream. stream_name Returns If the call succeeds, the server sends a reply information object with a...
  • Page 41: Getmsgcachestats()

    Description Returns detailed information about a live stream. See also getLiveStreams() getMsgCacheStats() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getMsgCacheStats() Parameters None. Returns If the call succeeds, the server sends a reply information object with a property of level property of , and a...
  • Page 42: Getnetstreams()

    getNetStreams() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getNetStreams(app_instance) Parameters A string that contains the name of the instance of the application, in the app_instance form application_name/instance_name Returns If the call succeeds, the server sends a reply information object with a property of level property of...
  • Page 43 Parameters A string that contains the name of the instance of the application, in the app_instance form application_name/instance_name A number that represents the ID of the network stream or an array of netstream_ID numbers that represents the network stream ID. To get information for all the network streams that are currently connected, specify a value of -1 for the parameter.
  • Page 44: Getrecordedstreams()

    getRecordedStreams() Availability Flash Player 6. Flash Media Server 2. Usage getRecordedStreams(app_name) Parameters A string that contains the name of the application or instance of the application, app_name in the form application_name[/instance_name] Returns If the call succeeds, the server sends a reply information object with a property of level property of...
  • Page 45: Getrecordedstreamstats()

    getRecordedStreamStats() Availability Flash Player 6. Flash Media Server 2. Usage getRecordedStreamStats(app_instance, stream_name) Parameters A string that contains the name of the instance of the application, in the app_instance form application_name/instance_name A string that contains the name of the stream. If the stream has a non-default stream_name virtual key or type, these items should be encoded into the stream name.
  • Page 46: Getscriptstats()

    getScriptStats() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getScriptStats(app_instance) Parameters A string that contains the name of the instance of the application, in the app_instance form application_name/instance_name Returns If the call succeeds, the server sends a reply information object with a property of level property of...
  • Page 47: Getserverstats()

    getServerStats() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getServerStats() Parameters None. Returns If the call succeeds, the server sends a reply information object with a property of level property of , and a property that is an status code NetConnection.Call.Success...
  • Page 48: Getservices()

    Property Description Number. On Microsoft Windows NT 4.0, the approximate percentage of memory_Usage the last 1000 pages of physical memory in use. On Windows 2000 or Windows XP, the approximate percentage of total physical memory in use. Number; approximate percentage of CPU in use by the Flash Media Server cpu_Usage processes—not by the entire system.
  • Page 49: Getsharedobjects()

    Description Returns an array containing the names of all the services currently connected to Flash Media Server. Special applications may connect and offer themselves as services to the Flash Media Server. These connections can currently only come through the Java or C SDK for Flash Media Server, as normal connections cannot register as a service.
  • Page 50: Getsharedobjectstats()

    See also getSharedObjectStats() getSharedObjectStats() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getSharedObjectStats(app_instance, object_name, persistence) Parameters A string that contains the name of the instance of the application, in the app_instance form application_name/instance_name A string that contains the name of the shared object. You can get the names of object_name all active shared objects by using the command.
  • Page 51: Getusers()

    If the call fails, the server sends a reply information object with a property of level error and a property of or a more specific value, if available. code NetConnection.Call.Failed Some objects might also have a property that contains a string describing the description cause of the failure.
  • Page 52: Getuserstats()

    See also getUserStats() getUserStats() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getUserStats(app_instance, user_ID) Parameters A string that contains the name of the instance of the application, in the app_instance form application_name/instance_name A string that contains the user ID, as assigned by the server. You can retrieve a user user_ID ID with the command.
  • Page 53: Getvhosts()

    Property Description String; protocol used by the client to connect to the server ("rtmp", protocol "rtmpt" or "rtmps".) Array of numbers that represent the stream IDs. stream_ids If the call fails, the server sends a reply information object with a property of level error...
  • Page 54: Getvhoststats()

    Description Returns an array of vhosts defined for the specified adaptor. You must be a server administrator to perform this command. getVHostStats() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage getVHostStats([adaptorName, vhostName]) Parameters Optional string that contains the user name of the adaptor. If not specified, it adaptorName is assumed to be "_defaultRoot_"...
  • Page 55 Property Description Number; total number of disconnections from the server. total_disconnects Number; total number of instances that have been loaded. total_instances_loaded This property does not represent the total number of active instances loaded. To get the number of active instances loaded, subtract the value of from total_instances_unloaded...
  • Page 56: Ping()

    ping() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage ping() Parameters None. Returns If the call succeeds, the server sends a reply information object with a property of level property of , and a property that status code NetConnection.Call.Success timestamp is a Date object.
  • Page 57: Removeadmin()

    Returns If the call succeeds, the server sends a reply information object with a property of level and a property of status code NetConnection.Call.Success If the call fails, the server sends a reply information object with a property of level error and a property of...
  • Page 58: Removeapp()

    Returns If the call succeeds, the server sends a reply information object with a property of level and a property of status code NetConnection.Call.Success If the call fails, the server sends a reply information object with a property of level error and a property of...
  • Page 59: Removevhostalias()

    Parameters A string that contains the name of the application or instance of the application app_name you want to remove, in the form application_name[/instance_name] Returns If the call succeeds, the server sends a reply information object with a property of level and a property of...
  • Page 60: Restartvhost()

    Usage removeVHostAlias(VHostName, AliasName) Parameters A string indicating the virtual host from which to remove an alias. VHostName A string indicating the alias name to remove from the specified vhost. AliasName Returns If the call succeeds, the server sends a reply information object with a property of level , and a...
  • Page 61 If the call fails, the server sends a reply information object with a property of level error and a property of or a more specific value, if code NetConnection.Admin.Command.Failed available. Some objects might also have a property that contains a string description describing the cause of the failure.
  • Page 62: Setconfig()

    setConfig() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage setConfig(key, key_value, [,scope]) Parameters A string that specifies the configuration key for which you want to change the value. A key is specified as a list of subkeys delimited by slashes ( ).
  • Page 63 For the Application.xml file of an application that is running on the same virtual host to which you connected when you logged on to the administration server, specify as the first subkey , where is the name of the application. Application:app_name app_name To get a key in the Application.xml file for an application that is running on a different...
  • Page 64 You must be a server administrator to change the values of most configuration keys in the Server.xml and Adaptor.xml files. For a description of the XML configuration files, see Managing Flash Media Server. It is possible to have more than one XML tag with the same name at the same level in the XML tree.
  • Page 65: Setconfig2()

    val = "true"; nc.call("setConfig", new onSetConfig(), key, val); // Change key in Application.xml for a different virtual host. // The adaptor and virtual host names and the second parameter are necessary. key = "Adaptor:_defaultRoot_/VirtualHost:www.redpin.com/ Application:ChatApp/ ¬ RecordAppLog"; val = "true"; nc.call("setConfig', new onSetConfig(), key, val, "/");...
  • Page 66 String; specifies the value to set for the tag specified by the parameter. If the scope value specified is a simple string, it is set as the tag data for the specified tag. If the value is valid XML, for example, <foo>bar</foo>, the XML is added as a child tag to the specified tag. If the value is an empty string, the specified tag is removed.
  • Page 67 Description Changes the value of the specified configuration key in a specified configuration file. Flash Media Server has six server configuration files: Server.xml, Users.xml, Logger.xml, Adaptor.xml, Vhost.xml, and Application.xml. Virtual host administrators can change the values of configuration keys in the Vhost.xml file and Application.xml files for their own virtual hosts.
  • Page 68: Startserver()

    // add child tag to a tag in default Application.xml key = "Process"; val = "<Scope>inst</Scope>"; scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_/App"; tSocket.call("setConfig2", new onSetConfig(), key, val, scope); // delete tag in default Application.xml key = "Process"; val = ""; scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_/App"; tSocket.call("setConfig2", new onSetConfig(), key, val, scope);...
  • Page 69: Startvhost()

    Description Starts the Flash Media Server service or stops it and restarts it. You must be a server administrator to perform this operation. See also stopServer() startVHost() Availability Flash Player 6. Flash Communication Server MX 1.0. Usage startVHost(vhost_name) Parameters A string that contains the name of the virtual host you want to start or the new vhost_name virtual host you want to enable, in the form [adaptor...
  • Page 70: Stopserver()

    Example The following example starts a virtual host named on the currently diamond.world.com connected adaptor and then starts a virtual host named on the diamond.world.com adaptor. /* Starts a virtual host named diamond.world.com */ nc.call("startVHost", new onStartVHost(), "diamond.world.com"); /* Starts a virtual host named diamond.world.com on the adaptor, gem */ nc.call("startVHost", new onStartVHost(), "gem/diamond.world.com");...
  • Page 71: Stopvhost()

    Description Shuts down the Flash Media Server. If you use this command while users are connected, you should take steps to notify users of an imminent server shutdown so that they do not lose their work. You must be a server administrator to perform this operation. See also startServer() stopVHost()
  • Page 72: Unloadapp()

    Example The following example stops the virtual host and then stops the virtual host tree.oak.com on the default adaptor. tree.oak.com /* Stop the vhost named tree.oak.com */ nc.call("stopVHost", new onStopVHost(), "tree.oak.com"); /* Stop the vhost named tree.oak.com on the default adaptor */ nc.call("stopVHost", new onStopVHost(), "_defaultRoot_/tree.oak.com");...
  • Page 73 Description Shuts down all instances of the specified application or instance of an application. If an application name is specified, all instances of the application are shut down and all the users who are connected to any instance of the application are immediately disconnected. If an instance of an application is specified, only that instance is shut down, and all the users who are connected to that instance are immediately disconnected.
  • Page 74 Server Management ActionScript Language Reference...

This manual is also suitable for:

Flash media server 2

Table of Contents