I am trying to do a simple POC for playing videos stored in S3 using a Wowza instance running on EC2.
I created an S3 bucket and uploaded a video. Then I launched an "Wowza Streaming Engine 4: BYOL Pro Edition (HVM)" instance that includes the vods3 application which is configured to play from S3.
But when I try to play the video (using flv:amazons3/<bucket name>/path/to/test.flv), it fails.
Looking at the Wowza logs, I see that when Wowza tries to access the resource in S3 using a URL of type .
s3.amazonaws.com/path/to/test.flv, it gets a 307 response code which tries to redirect it to another S3 endpoint ( .
s3-eu-west-1.amazonaws.com). Wowza does not follow this redirect but treats it as an error.
When trying the Wowza example S3 video (mp4:amazons3/wowzamediacache/sample/sample.mp4), it works fine. And indeed when I try to access this resource using
wowzamediacache.s3.amazonaws.com/sample/sample.mp4, I get the resource rather than a 307 response.
requires its clients to support redirects when accessing content stored in it. This is because the generic S3 URLs (starting with
http://bucket.s3.amazonaws.com) might hit any instance of S3 and may be redirected to the one that contains the required content. It seems like Wozwa does not handle the redirects automatically, because when looking at the logs I see the redirect replies (307, 301) are considered errors. i'm still waiting for a formal approval from Wowza, but I believe this is a bug.
Luckily, S3 supports more explicit URLs, that look like this:
http://bucket.s3-aws-region.amazonaws.com. So if you know the region that contains the content, using this URL you will never get a redirect. To make Wowza use these URLs, you can define a unique MediaCacheSource per region (in /usr/local/WowzaStreamingEngine/conf/MediaCache.xml, if you're running on Linux). Each region could have a MediaCacheSource with a unique name, for example amazons3-region-name. The region-specific MediaCacheSource is identical to the original amazons3 MediaCacheSource, only with a different BasePath - the one matching the specific region.
Then, you can access the video using a stream name that relates to the specific MediaCacheSource, for example flv:amazons3-region-name/<bucket name>/path/to/test.flv.