mirror of
https://github.com/koel/koel
synced 2024-12-26 04:23:05 +00:00
35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Services\Streamers\DirectStreamerInterface;
|
|
use App\Services\Streamers\ObjectStorageStreamerInterface;
|
|
use App\Services\Streamers\PhpStreamer;
|
|
use App\Services\Streamers\S3Streamer;
|
|
use App\Services\Streamers\TranscodingStreamer;
|
|
use App\Services\Streamers\TranscodingStreamerInterface;
|
|
use App\Services\Streamers\XAccelRedirectStreamer;
|
|
use App\Services\Streamers\XSendFileStreamer;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class StreamerServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->bind(DirectStreamerInterface::class, static function (): DirectStreamerInterface {
|
|
switch (config('koel.streaming.method')) {
|
|
case 'x-sendfile':
|
|
return new XSendFileStreamer();
|
|
|
|
case 'x-accel-redirect':
|
|
return new XAccelRedirectStreamer();
|
|
|
|
default:
|
|
return new PhpStreamer();
|
|
}
|
|
});
|
|
|
|
$this->app->bind(TranscodingStreamerInterface::class, TranscodingStreamer::class);
|
|
$this->app->bind(ObjectStorageStreamerInterface::class, S3Streamer::class);
|
|
}
|
|
}
|