phanan /
koel
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Services\Streamers; |
||
| 4 | |||
| 5 | use App\Services\S3Service; |
||
| 6 | |||
| 7 | class S3Streamer extends Streamer implements ObjectStorageStreamerInterface |
||
| 8 | { |
||
| 9 | private $s3Service; |
||
| 10 | |||
| 11 | 11 | public function __construct(S3Service $s3Service) |
|
| 12 | { |
||
| 13 | 11 | parent::__construct(); |
|
| 14 | 11 | $this->s3Service = $s3Service; |
|
| 15 | 11 | } |
|
| 16 | |||
| 17 | /** |
||
| 18 | * Stream the current song through S3. |
||
| 19 | * Actually, we just redirect the request to the S3 object's location. |
||
| 20 | */ |
||
| 21 | public function stream() |
||
| 22 | { |
||
| 23 | // Get and redirect to the actual presigned-url |
||
| 24 | return redirect($this->s3Service->getSongPublicUrl($this->song)); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 25 | } |
||
| 26 | } |
||
| 27 |