
49
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
By default, the server stores persistent shared objects in the
rootinstalldir\applications\appname\sharedobjects\_definst_ directory.
By default, the server looks for streams for the default application instance in the directory
rootinstalldir\applications\appname\streams\_definst_. For example, a client that connects to
"rtmp://someamssever.com/test" looks for streams in the rootinstalldir\applications\test\streams\_definst_ directory.
A client that connects to "rtmp://someamsserver.com/test/room1" looks for streams in the
rootinstalldir\applications\test\streams\room1 directory.
Suppose there is a stream called "sample.f4v" in the applications\test\streams\_definst_ directory. In the server-side
script, if you give
client.readAccess any value other than "/", the stream does not play.
Note: If you specify "\", the script does not run.
Suppose you copy the file sample2.f4v into the directory test/streams/_definst_/protected. In the server-side script, set
client.readAccess="protected". In the client-side script, call
netstream.play("mp4:protected/sample2.f4v"). The file plays because it’s located in a directory that has read
access.
Now call netstream.play("mp4:sample.f4v"). The file does not play because the test/streams/_definst_ directory
does not have read access.
Availability
Flash Communication Server 1
Details
To give a client read access, specify a list of directories (in URI format), delimited by semicolons. Any files or
directories within a specified URI are also considered accessible. For example, if you specify
"myMedia", any files or
directories in the myMedia directory are also accessible (for example, myMedia/mp3s). Any files or directories in the
myMedia/mp3s directory are also accessible, and so on.
Clients with read access to a directory that contains streams can play the streams. Clients with read access to a directory
that contains shared objects can subscribe to the shared objects and receive notification of changes in the shared
objects.
• For streams, readAccess controls the streams that the connection can play.
• For shared objects, readAccess controls whether the connection can listen to shared object changes.
To control access for a particular file, create a separate directory for the file and set readAccess to that directory.
Note: You cannot set this property in the application.onPublish() event.
Example
The following code is for an application called “amsapp”. It gives clients read access to all files in the folders
mymedia/mp3s and mydata/notes. The clients also have read access to any files in subfolders of those folders.
application.onConnect = function(newClient, name){
newClient.readAccess = "mymedia/mp3s;mydata/notes";
};
Clients that connect to an instance of the application “amsapp” can play streams in the folder
rootinstall/applications/amsapp/streams/instancename/mymedia/mp3s and all its subfolders. Those clients can listen
for changes to shared objects in the folder rootinstall/applications/amsapp/sharedobjects/instancename/mydata/notes
and all its subfolders.
Commenti su questo manuale