storage_metadata instanceof S3CompatibleMetadata) { return tap( app(S3CompatibleStreamer::class), static fn (S3CompatibleStreamer $streamer) => $streamer->setSong($song) ); } $transcode ??= $this->transcodingService->songShouldBeTranscoded($song); if ($transcode) { /** @var TranscodingStreamer $streamer */ $streamer = app(TranscodingStreamer::class); $streamer->setSong($song); $streamer->setBitRate($bitRate ?: config('koel.streaming.bitrate')); $streamer->setStartTime($startTime); return $streamer; } return tap( app(LocalStreamerInterface::class), static fn (LocalStreamerInterface $streamer) => $streamer->setSong($song) ); } }