koel/app/Http/Controllers/PlayController.php
2021-06-05 12:47:56 +02:00

24 lines
625 B
PHP

<?php
namespace App\Http\Controllers;
use App\Factories\StreamerFactory;
use App\Http\Requests\SongPlayRequest;
use App\Models\Song;
class PlayController extends Controller
{
private StreamerFactory $streamerFactory;
public function __construct(StreamerFactory $streamerFactory)
{
$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();
}
}