39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace BlaxSoftware\LaravelWebRtc;
|
||
|
|
|
||
|
|
use BlaxSoftware\LaravelWebRtc\Console\Commands\StartWebRtcServer;
|
||
|
|
use BlaxSoftware\LaravelWebRtc\Contracts\MediaEngine;
|
||
|
|
use BlaxSoftware\LaravelWebRtc\Media\NullMediaEngine;
|
||
|
|
use Illuminate\Support\ServiceProvider;
|
||
|
|
|
||
|
|
class WebRtcServiceProvider extends ServiceProvider
|
||
|
|
{
|
||
|
|
public function register(): void
|
||
|
|
{
|
||
|
|
$this->mergeConfigFrom(__DIR__ . '/../config/webrtc.php', 'webrtc');
|
||
|
|
|
||
|
|
// Resolve the configured media engine wherever a MediaEngine is type-hinted.
|
||
|
|
$this->app->bind(MediaEngine::class, function ($app) {
|
||
|
|
$class = (string) config('webrtc.media_engine', NullMediaEngine::class);
|
||
|
|
|
||
|
|
return $app->make($class);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public function boot(): void
|
||
|
|
{
|
||
|
|
if ($this->app->runningInConsole()) {
|
||
|
|
$this->publishes([
|
||
|
|
__DIR__ . '/../config/webrtc.php' => $this->app->configPath('webrtc.php'),
|
||
|
|
], 'webrtc-config');
|
||
|
|
|
||
|
|
$this->commands([
|
||
|
|
StartWebRtcServer::class,
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|