mirror of
https://github.com/koel/koel
synced 2024-12-24 19:43:06 +00:00
28 lines
740 B
PHP
28 lines
740 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers;
|
||
|
|
||
|
use App\Factories\StreamerFactory;
|
||
|
use App\Http\Requests\SongPlayRequest;
|
||
|
use App\Models\Song;
|
||
|
use App\Services\TokenManager;
|
||
|
|
||
|
class PlayController extends Controller
|
||
|
{
|
||
|
private $tokenManager;
|
||
|
private $streamerFactory;
|
||
|
|
||
|
public function __construct(TokenManager $tokenManager, StreamerFactory $streamerFactory)
|
||
|
{
|
||
|
$this->tokenManager = $tokenManager;
|
||
|
$this->streamerFactory = $streamerFactory;
|
||
|
}
|
||
|
|
||
|
public function show(SongPlayRequest $request, Song $song, ?bool $transcode = null, ?int $bitRate = null)
|
||
|
{
|
||
|
return $this->streamerFactory
|
||
|
->createStreamer($song, $transcode, $bitRate, floatval($request->time))
|
||
|
->stream();
|
||
|
}
|
||
|
}
|