2018-08-22 17:59:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2024-02-05 13:27:17 +00:00
|
|
|
use App\Services\Streamers\LocalStreamer;
|
2021-01-31 17:49:54 +00:00
|
|
|
use App\Services\Streamers\PhpStreamer;
|
2018-08-22 17:59:14 +00:00
|
|
|
use App\Services\Streamers\XAccelRedirectStreamer;
|
|
|
|
use App\Services\Streamers\XSendFileStreamer;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
class StreamerServiceProvider extends ServiceProvider
|
|
|
|
{
|
2018-08-29 04:06:17 +00:00
|
|
|
public function register(): void
|
2018-08-22 17:59:14 +00:00
|
|
|
{
|
2024-02-05 13:27:17 +00:00
|
|
|
$this->app->bind(LocalStreamer::class, static function (): LocalStreamer {
|
2022-07-29 06:47:10 +00:00
|
|
|
return match (config('koel.streaming.method')) {
|
|
|
|
'x-sendfile' => new XSendFileStreamer(),
|
|
|
|
'x-accel-redirect' => new XAccelRedirectStreamer(),
|
|
|
|
default => new PhpStreamer(),
|
|
|
|
};
|
2018-08-22 19:13:45 +00:00
|
|
|
});
|
2018-08-22 17:59:14 +00:00
|
|
|
}
|
|
|
|
}
|