koel/app/Http/Controllers/PlayController.php

22 lines
533 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
use App\Factories\StreamerFactory;
use App\Http\Requests\SongPlayRequest;
use App\Models\Song;
class PlayController extends Controller
{
2022-07-29 06:47:10 +00:00
public function __construct(private StreamerFactory $streamerFactory)
{
}
public function show(SongPlayRequest $request, Song $song, ?bool $transcode = null, ?int $bitRate = null)
{
return $this->streamerFactory
2022-07-29 06:47:10 +00:00
->createStreamer($song, $transcode, $bitRate, (float) $request->time)
->stream();
}
}