Is there a way to stream MP3s stored on Amazon S3 via a Flash widget embedded in a website, or some other method?
To stream audio, s3 includes a downloadStream method which will create a read stream pointed at a file stored on S3 and then pipe it down to the client response. To tell s3 which file we want to download, we need to pass it the name of the S3 Bucket it is stored in as well as its Key value.
Wowza. Wowza Streaming Engine software is a customizable and scalable server solution that powers reliable streaming of high-quality video and audio to any device, anywhere.
Yes it is. Firstly, you need to create a bucket in your S3 account which is all in lower case, is globally unique and is DNS-compatible; so for example I created a bucket called ‘media.torusknot.com’.
Then to make it all look nice you need to create a DNS CNAME entry to map a sub-domain of your site to that S3 bucket. That will allow you to access your files you upload to that S3 bucket via ‘http://media.example.com/somefile.mp3’. You do just need to set the ACLs on the files & the bucket to make sure public access is allowed.
Finally, if you want to stream video files via a Flash player from S3 to another domain, you also have to tell Flash that it’s ok for the content to be pulled in from a different domain. Create a file called ‘crossdomain.xml’ in the bucket, with these contents:
<cross-domain-policy> <site-control permitted-cross-domain-policies="all"/> </cross>
That allows the media to be accessed from anywhere - you can be more specific if you want but this is the simplest approach.
Related resources:
To update the answer to this question, if you want to actually STREAM to clients, you can use Amazon Cloudfront on top of your S3 bucket (as mentioned by Rudolf). Create a "streaming distribution" in Cloudfront that points to your S3 bucket.
This will stream via RTMP (good for web and Android devices). You can use JW Player or a similar player to play the streamed files.
Cloudfront Streaming uses Adobe Flash Media Server 3.5.
There is also the ability to play secure content using signed urls.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With