koel/app/Services/Streamers/S3Streamer.php

27 lines
618 B
PHP
Raw Normal View History

2016-06-13 09:04:42 +00:00
<?php
2017-04-20 11:20:32 +00:00
namespace App\Services\Streamers;
2016-06-13 09:04:42 +00:00
2018-08-29 04:06:17 +00:00
use App\Services\S3Service;
2018-08-22 17:59:14 +00:00
class S3Streamer extends Streamer implements ObjectStorageStreamerInterface
2016-06-13 09:04:42 +00:00
{
2018-08-29 04:06:17 +00:00
private $s3Service;
public function __construct(S3Service $s3Service)
{
parent::__construct();
$this->s3Service = $s3Service;
}
2016-06-13 09:04:42 +00:00
/**
* Stream the current song through S3.
2018-08-29 04:06:17 +00:00
* Actually, we just redirect the request to the S3 object's location.
2016-06-13 09:04:42 +00:00
*/
2016-07-11 07:26:39 +00:00
public function stream()
2016-06-13 09:04:42 +00:00
{
// Get and redirect to the actual presigned-url
2018-08-29 04:06:17 +00:00
return redirect($this->s3Service->getSongPublicUrl($this->song));
2016-06-13 09:04:42 +00:00
}
}