Advertisement
jimgreeno

Untitled

Apr 14th, 2018
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.25 KB | None | 0 0
  1. unzip AdobeMediaServerStarter_5_x64_LS1_All.zip
  2. cd windows
  3. tar -xvzf AdobeMediaServer_5_LS1_windows32.tar.gz
  4. cd AMS_5_0_1_r1076/
  5. ln -s /lib64/libcap.so.2 libcap.so.1
  6. sudo ./installAMS/localhost.one - 127.0.0.1
  7. cd /opt/adobe/ams
  8. sudo ./server stop
  9. sudo ln -s /lib64/libcap.so.2 libcap.so.1
  10. sudo ./server startams.ini
  11. ...
  12. AVALON.STREAM_PATH = <amsdir>/webroot/avalon
  13. AVALON.AUTH_URL = http://avalon.domain.edu/authorize<amsdir>/applications/avalon/<Application>
  14.     <JSEngine>
  15.         <ApplicationObject>
  16.             <config>
  17.                 <avalonAuthUrl>${AVALON.AUTH_URL}</avalonAuthUrl>
  18.             </config>
  19.         </ApplicationObject>
  20.     </JSEngine>
  21.    
  22.     <StreamManager>
  23.         <VirtualDirectory>
  24.       <!-- Specifies application specific virtual directory mapping for recorded streams.   -->
  25.             <Streams>/;${AVALON.STREAM_PATH}</Streams>
  26.      
  27.         </VirtualDirectory>
  28.     </StreamManager>
  29.    
  30.    
  31.    
  32.     <!-- Settings specific to runtime script engine memory -->
  33.     <ScriptEngine>
  34.         <!-- This specifies the max size (Kb.) the runtime can grow to before -->
  35.         <!-- garbage collection is performed.                                 -->
  36.         <RuntimeSize>20480</RuntimeSize>
  37.     </ScriptEngine>
  38.  
  39.    
  40.     <Client>
  41.         <Bandwidth>
  42.             <!-- Specified in bytes/sec -->
  43.             <ServerToClient>2500000</ServerToClient>
  44.             <!-- Specified in bytes/sec -->
  45.             <ClientToServer>2500000</ClientToServer>
  46.         </Bandwidth>
  47.                
  48.         <MsgQueue>
  49.             <Live>
  50.                 <!-- Drop live audio if audio q exceeds time specified. time in milliseconds -->
  51.                 <MaxAudioLatency>2000</MaxAudioLatency>
  52.                 <!-- Default buffer length in millisecond for live audio and video queue. -->
  53.                 <MinBufferTime>2000</MinBufferTime>
  54.             </Live>
  55.             <Recorded>
  56.                 <!-- Default buffer length in millisecond for live audio and video, value cannot be set below this by Flash player. -->
  57.                 <MinBufferTime>2000</MinBufferTime>
  58.             </Recorded>
  59.             <Server>
  60.                 <!-- Ratio of the buffer length used by server side stream -->
  61.                 <!-- to live buffer.  The value is between 0 and 1.  To    -->
  62.                 <!-- avoid break up of audio, the ratio should not be more -->
  63.                 <!-- than 0.5 of the live buffer.                          -->
  64.                 <BufferRatio>0.5</BufferRatio>
  65.             </Server>
  66.         </MsgQueue>
  67.     </Client>
  68.  
  69. </Application> <amsdir>/Apache2.2/conf/httpd.conf>
  70.  
  71.  
  72. /*
  73.  * Avalon Media System authenticated RTMP streaming application for
  74.  * Adobe Media Server.
  75.  *
  76.  * Add the following keys to your <ams_install_home>/conf/ams.ini:
  77.  *      AVALON.AUTH_URL = http://localhost/authorize
  78.  *      AVALON.STREAM_PATH = /opt/adobe/ams/webroot/avalon
  79.  */
  80.  
  81. application.onAppStart = function()
  82. {
  83.     // Logging
  84.     trace("Starting Avalon Streaming app...");
  85.     this.avalonAuthUrl = application.config.avalonAuthUrl;
  86.     trace("Requests will be authenticated against " + this.avalonAuthUrl);
  87.     trace("...loading completed.");
  88. }
  89.  
  90. application.onConnect = function( p_client, p_autoSenseBW )
  91. {
  92.     //Add security here
  93.     p_client.writeAccess = ""; // prevents creating shared object or live streams.
  94.     p_client.readAccess = "";  // no access by default
  95.  
  96.     var xhttp = new LoadVars();
  97.     xhttp.decode(p_client.uri.split("?")[1]);
  98.     if (!xhttp.hasOwnProperty('token')) {
  99.         trace('Missing token in request.');
  100.         application.rejectConnection(p_client);
  101.         return false;
  102.     }
  103.    
  104.     var authed = false;
  105.     xhttp.onHTTPStatus = function(status) {
  106.         trace('Received ' + status);
  107.         switch (status) {
  108.             case 202:
  109.                 trace("Authorized")
  110.                 authed = true;
  111.                 break;
  112.             case 403:
  113.                 trace("Unauthorized")
  114.                 authed = false;
  115.                 break;
  116.         };
  117.     }
  118.    
  119.     xhttp.onLoad = function() {
  120.         if (authed) {
  121.             // grant access to the specific mediapackage directories authorized
  122.             p_client.readAccess = xhttp['authorized'].replace(" ",";");
  123.         }
  124.         // Accept the connection no matter what; the denial will happen when the stream is requested
  125.         application.acceptConnection(p_client);
  126.         if (p_client.readAccess.length > 0) {
  127.             trace("Client can read " + p_client.readAccess);
  128.         } else {
  129.             trace("Client cannot read anything");
  130.         }
  131.  
  132.         if (p_autoSenseBW)
  133.             p_client.checkBandwidth();
  134.         else
  135.             p_client.call("onBWDone");
  136.     }
  137.  
  138.     var authUrl = application.avalonAuthUrl;
  139.     trace('Authorizing against ' + authUrl);
  140.     xhttp.addRequestHeader('accept','application/x-www-urlform-encoded')
  141.     xhttp.sendAndLoad(authUrl,xhttp);
  142.     return null;
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement