php - Laravel 4 stream mp3 from s3 without CNAME buckets -
php - Laravel 4 stream mp3 from s3 without CNAME buckets -
according other answers, best way create cname bucket / record , stream way. however, unable due copyright concerns , must stream through app (in order log user plays, among many other things).
i have mp3's on s3 in bucket my-bucket
. mp3's publicly accessible @ https://s3.amazonaws.com/my-bucket
.
i have code router:
router.php route::get("/music/{id}.mp3", "controller\music@play"); music.php namespace controller; class music extends \controller\base { public function play($id) { $return = file_get_contents("https://s3.amazonaws.com/my-bucket/$id"); if( !$return ) homecoming "false"; $response = response::make($return, 200)->header('content-type', "audio/mpeg"); homecoming $response; } }
now, on ssl-secured server, actual sound file display not play or stream. thought on how accomplish this?
edit: also, realize paying double bandwidth costs (s3 servers, servers world) , fine.
php laravel laravel-4 amazon-s3 laravel-routing
Comments
Post a Comment