Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unzip AdobeMediaServerStarter_5_x64_LS1_All.zip
- cd windows
- tar -xvzf AdobeMediaServer_5_LS1_windows32.tar.gz
- cd AMS_5_0_1_r1076/
- ln -s /lib64/libcap.so.2 libcap.so.1
- sudo ./installAMS/localhost.one - 127.0.0.1
- cd /opt/adobe/ams
- sudo ./server stop
- sudo ln -s /lib64/libcap.so.2 libcap.so.1
- sudo ./server startams.ini
- ...
- AVALON.STREAM_PATH = <amsdir>/webroot/avalon
- AVALON.AUTH_URL = http://avalon.domain.edu/authorize<amsdir>/applications/avalon/<Application>
- <JSEngine>
- <ApplicationObject>
- <config>
- <avalonAuthUrl>${AVALON.AUTH_URL}</avalonAuthUrl>
- </config>
- </ApplicationObject>
- </JSEngine>
- <StreamManager>
- <VirtualDirectory>
- <!-- Specifies application specific virtual directory mapping for recorded streams. -->
- <Streams>/;${AVALON.STREAM_PATH}</Streams>
- </VirtualDirectory>
- </StreamManager>
- <!-- Settings specific to runtime script engine memory -->
- <ScriptEngine>
- <!-- This specifies the max size (Kb.) the runtime can grow to before -->
- <!-- garbage collection is performed. -->
- <RuntimeSize>20480</RuntimeSize>
- </ScriptEngine>
- <Client>
- <Bandwidth>
- <!-- Specified in bytes/sec -->
- <ServerToClient>2500000</ServerToClient>
- <!-- Specified in bytes/sec -->
- <ClientToServer>2500000</ClientToServer>
- </Bandwidth>
- <MsgQueue>
- <Live>
- <!-- Drop live audio if audio q exceeds time specified. time in milliseconds -->
- <MaxAudioLatency>2000</MaxAudioLatency>
- <!-- Default buffer length in millisecond for live audio and video queue. -->
- <MinBufferTime>2000</MinBufferTime>
- </Live>
- <Recorded>
- <!-- Default buffer length in millisecond for live audio and video, value cannot be set below this by Flash player. -->
- <MinBufferTime>2000</MinBufferTime>
- </Recorded>
- <Server>
- <!-- Ratio of the buffer length used by server side stream -->
- <!-- to live buffer. The value is between 0 and 1. To -->
- <!-- avoid break up of audio, the ratio should not be more -->
- <!-- than 0.5 of the live buffer. -->
- <BufferRatio>0.5</BufferRatio>
- </Server>
- </MsgQueue>
- </Client>
- </Application> <amsdir>/Apache2.2/conf/httpd.conf>
- /*
- * Avalon Media System authenticated RTMP streaming application for
- * Adobe Media Server.
- *
- * Add the following keys to your <ams_install_home>/conf/ams.ini:
- * AVALON.AUTH_URL = http://localhost/authorize
- * AVALON.STREAM_PATH = /opt/adobe/ams/webroot/avalon
- */
- application.onAppStart = function()
- {
- // Logging
- trace("Starting Avalon Streaming app...");
- this.avalonAuthUrl = application.config.avalonAuthUrl;
- trace("Requests will be authenticated against " + this.avalonAuthUrl);
- trace("...loading completed.");
- }
- application.onConnect = function( p_client, p_autoSenseBW )
- {
- //Add security here
- p_client.writeAccess = ""; // prevents creating shared object or live streams.
- p_client.readAccess = ""; // no access by default
- var xhttp = new LoadVars();
- xhttp.decode(p_client.uri.split("?")[1]);
- if (!xhttp.hasOwnProperty('token')) {
- trace('Missing token in request.');
- application.rejectConnection(p_client);
- return false;
- }
- var authed = false;
- xhttp.onHTTPStatus = function(status) {
- trace('Received ' + status);
- switch (status) {
- case 202:
- trace("Authorized")
- authed = true;
- break;
- case 403:
- trace("Unauthorized")
- authed = false;
- break;
- };
- }
- xhttp.onLoad = function() {
- if (authed) {
- // grant access to the specific mediapackage directories authorized
- p_client.readAccess = xhttp['authorized'].replace(" ",";");
- }
- // Accept the connection no matter what; the denial will happen when the stream is requested
- application.acceptConnection(p_client);
- if (p_client.readAccess.length > 0) {
- trace("Client can read " + p_client.readAccess);
- } else {
- trace("Client cannot read anything");
- }
- if (p_autoSenseBW)
- p_client.checkBandwidth();
- else
- p_client.call("onBWDone");
- }
- var authUrl = application.avalonAuthUrl;
- trace('Authorizing against ' + authUrl);
- xhttp.addRequestHeader('accept','application/x-www-urlform-encoded')
- xhttp.sendAndLoad(authUrl,xhttp);
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement