
166
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
When you publish a stream, you can specify a query string in the stream path with parameters that specify how to
configure the live queue. Access the
publishQueryString property (for example, from inside the
application.onPublish() function) to access the query string. Parse the string to get the configuration parameters.
Use the values from the configuration parameters to set the
Stream.maxQueueDelay and Stream.maxQueueSize
properties.
Note: Flash Media Live Encoder 3 supports adding query strings to stream names. Earlier versions of Flash Media
Encoder did not support query strings.
Availability
Flash Media Server 3.5
Example
The following client-side code publishes a stream with a query string:
ns.publish
("exampleVideo?com.adobe.ams.maxQueueDelay=4000&com.adobe.ams.maxQueueSize=10240");
}
The following server-side code gets the query string, extracts the delay and size, and configures the live queue by setting
the
maxQueueDelay and maxQueueSize properties:
application.onPublish = function(clientObj, streamObj){
trace("queryString : " + streamObj.publishQueryString);
// the helper function extracQueryStringArg() is defined below
delay = extractQueryStringArg(streamObj.pubishQueryString, "com.adobe.ams.maxQueueDelay");
size = extractQueryStringArg(streamObj.publishQueryString, "com.adobe.ams.maxQueueSize");
trace("old maxQueueDelay : " + streamObj.maxQueueDelay);
streamObj.maxQueueDelay = delay;
trace("new maxQueueDelay : " + streamObj.maxQueueDelay);
trace("old maxQueueSize : " + streamObj.maxQueueSize);
streamObj.maxQueueSize = size;
trace("new maxQueueSize : " + streamObj.maxQueueSize);
}
function extractQueryStringArg(queryString, arg)
{
var retVal = "";
temp = arg + "=";
i = queryString.indexOf(temp);
if (i != 0)
{
temp = "&" + arg + "=";
i = queryString.indexOf(temp);
}
if (i != -1)
{
retVal = queryString.substr(i+temp.length);
i = retVal.indexOf("&");
if (i != -1)
{
retVal = retVal.substr(0, i);
}
}
return retVal;
}
Komentarze do niniejszej Instrukcji