• How to use Amazon S3 with a standalone Wowza media server and the MediaCache AddOn

    This article provides basic steps for configuring your standalone Wowza media server software to use your Amazon S3 account.

    Note: Requires Wowza Media Server™ software version 3.6.4 and MediaCache 2.0 build 5900.

    Contents


    External requirements
    Configuration
    AWS security credentials
    Playback
    Troubleshooting

    External requirements


    1. You must have the Media Cache AddOn.

    2. Sign up for an Amazon S3 account.

    Configuration


    1. To initiate MediaCache, define a listener at the server level. You can do this in the [install-dir]/conf/Server.xml file under the Root/Server/ServerListeners node.
      <ServerListener>
          <BaseClass>com.wowza.wms.plugin.mediacache.impl.MediaCacheServerListener</BaseClass>
      </ServerListener>
    2. Create a new application to be configured with MediaCache AddOn:

      1. Create an application folder named [install-dir]/applications/aws.

      2. Create a configuration folder named [install-dir]/conf/aws and copy [install-dir]/conf/Application.xml to this new folder.

      3. Edit the newly copied Application.xml file and make the following changes under <Root>/<Application>:
        <MediaReader>
             <Properties>
                  <Property>
                     <Name>randomAccessReaderClass</Name>
                     <Value>com.wowza.wms.plugin.mediacache.impl.MediaCacheRandomAccessReader</Value>
                   </Property>
                   <Property>
                      <Name>bufferSeekIO</Name>
                      <Value>true</Value>
                      <Type>Boolean</Type>
                   </Property>
              </Properties>
        </MediaReader>
    3. Include the following MediaCacheSource configuration in your [install-dir]/conf/MediaCache.xml file under /Root/MediaCacheSources as follows:

      Note: If your MediaCache.xml file already has a default amazons3 MediaCacheSource, then just modify the existing elements.
      <MediaCacheSource>
      	 <Name>amazons3</Name>
      	 <BasePath>http://s3.amazonaws.com/</BasePath>
      	 <Prefix>amazons3/</Prefix>
      	 <BaseClass>com.wowza.wms.plugin.mediacache.impl.MediaCacheItemHTTPImpl</BaseClass>
      	 <ReaderClass></ReaderClass>
      	 <DefaultBlockSize>262144</DefaultBlockSize>
      	 <MaxTimeToLive>1200000</MaxTimeToLive>
      	 <MinTimeToLive>600000</MinTimeToLive>
      	 <ReadAhead>true</ReadAhead>
      	 <ReadAheadThreshold>50</ReadAheadThreshold>
      	 <IsPassThru>false</IsPassThru>
      	 <Properties>
      	     <Property>
      	         <Name>maxPoolSize</Name>
      	         <Value>25</Value>
      	         <Type>Integer</Type>
      	     </Property>
      	     <Property>
      	         <Name>httpReadTimeout</Name>
      	         <Value>6000</Value>
      	         <Type>Integer</Type>
      	     </Property>
      	     <Property>
      	         <Name>httpConnectionTimeout</Name>
      	         <Value>6000</Value>
      	         <Type>Integer</Type>
      	     </Property>
      	     <Property>
      	         <Name>httpReadRetries</Name>
      	         <Value>3</Value>
      	         <Type>Integer</Type>
      	     </Property>
      	     <Property>
      	         <Name>httpSendBufferSize</Name>
      	         <Value>8000</Value>
      	         <Type>Integer</Type>
      	     </Property>
      	     <Property>
      	         <Name>httpReceiveBufferSize</Name>
      	         <Value>65000</Value>
      	         <Type>Integer</Type>
      	     </Property>
      	     <Property>
      	         <Name>isAmazonS3</Name>
      	         <Value>true</Value>
      	         <Type>Boolean</Type>
      	     </Property>
      	     <Property>
      	         <Name>s3BucketNameInDomain</Name>
      	         <Value>true</Value>
      	         <Type>Boolean</Type>
      	     </Property>
      	     <Property>
      	          <Name>awsAccessKeyId</Name>
      	          <Value>[aws-access-key]</Value>
      	     </Property>
      	     <Property>
      	          <Name>awsSecretAccessKey</Name>
      	          <Value>[aws-secret-key]</Value>
      	     </Property>
      	 </Properties>
      </MediaCacheSource>

    AWS security credentials


    Log in to your AWS account to get your access key and secret. Enter these in the corresponding XML node(s) within your [install-dir]/conf/MediaCache.xml file under /Root/MediaCacheSources/MediaCacheSource:
    <Property>
            <Name>awsAccessKeyId</Name>
            <Value>[access-key]</Value>
    </Property>
    <Property>
            <Name>awsSecretAccessKey</Name>
            <Value>[secret-key]</Value>
    </Property>

    Playback


    The default playback will include the MediaCacheSource name along with the bucket name as specified in this configuration.

    Adobe Flash Player (RTMP)


    rtmp://[wowza-server-ip]/aws/_definst_/mp4:amazons3/mybucket/subfolder/mycoolvideo.mp4

    Adobe Flash Player (Flash HDS)


    http://[wowza-server-ip]/aws/_definst_/mp4:amazons3/mybucket/subfolder/mycoolvideo.mp4/manifest.f4m

    Apple iOS device (Apple HLS)


    http://[wowza-server-ip]/aws/_definst_/mp4:amazons3/mybucket/subfolder/mycoolvideo.mp4/playlist.m3u8

    Microsoft Silverlight (Smooth Streaming)


    http://[wowza-server-ip]/aws/_definst_/mp4:amazons3/mybucket/subfolder/mycoolvideo.mp4/Manifest

    RTSP/RTP Player or Device


    http://[wowza-server-ip]/aws/_definst_/mp4:amazons3/mybucket/subfolder/mycoolvideo.mp4

    Troubleshooting


    You should see the following log entries in the console on successful connection:

    INFO server comment - MediaCacheImpl.start[MediaCache]: Add source[amazons3]: prefix:amazons3/ basePath:http://s3.amazonaws.com/
    On playback:
    INFO server comment - MediaCacheItemHTTPImpl.head ...
    INFO server comment - MediaCacheItemHTTPImpl.read ...
    If you enter in an invalid access key/secret, you'll probably see the following 403 response:
    WARN server comment - MediaCacheItemHTTPImpl.getItemInfo[xxxxxx.s3.amazonaws.com/path/to/file.mp4]: HTTP response: 403
    INFO server comment - MediaCacheItemHTTPImpl.head: url:xxxxxxx.s3.amazonaws.com:80/path/to/file.mp4 status:403 tries:0 flen:0 modDate:0 time:804

    Originally Published: 11-17-2013.
    Updated: For Wowza Media Server 3.6.4 on 01-03-2014.

    If you're having problems or want to discuss this article, post in our forum.