2018-08-22 17:59:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2024-02-24 07:28:49 +00:00
|
|
|
use App\Services\Streamer\Adapters\LocalStreamerAdapter;
|
|
|
|
use App\Services\Streamer\Adapters\PhpStreamerAdapter;
|
|
|
|
use App\Services\Streamer\Adapters\XAccelRedirectStreamerAdapter;
|
|
|
|
use App\Services\Streamer\Adapters\XSendFileStreamerAdapter;
|
2018-08-22 17:59:14 +00:00
|
|
|
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-24 07:28:49 +00:00
|
|
|
$this->app->bind(LocalStreamerAdapter::class, function (): LocalStreamerAdapter {
|
2022-07-29 06:47:10 +00:00
|
|
|
return match (config('koel.streaming.method')) {
|
2024-02-24 07:28:49 +00:00
|
|
|
'x-sendfile' => $this->app->make(XSendFileStreamerAdapter::class),
|
|
|
|
'x-accel-redirect' => $this->app->make(XAccelRedirectStreamerAdapter::class),
|
|
|
|
default => $this->app->make(PhpStreamerAdapter::class),
|
2022-07-29 06:47:10 +00:00
|
|
|
};
|
2018-08-22 19:13:45 +00:00
|
|
|
});
|
2018-08-22 17:59:14 +00:00
|
|
|
}
|
|
|
|
}
|