directStreamer = $directStreamer; $this->transcodingStreamer = $transcodingStreamer; $this->objectStorageStreamer = $objectStorageStreamer; $this->transcodingService = $transcodingService; } /** * @param Song $song * @param bool|null $transcode * @param int|null $bitRate * @param int $startTime * * @return StreamerInterface */ public function createStreamer(Song $song, $transcode = null, $bitRate = null, $startTime = 0) { if ($song->s3_params) { $this->objectStorageStreamer->setSong($song); return $this->objectStorageStreamer; } if ($transcode === null && $this->transcodingService->songShouldBeTranscoded($song)) { $transcode = true; } if ($transcode) { $this->transcodingStreamer->setSong($song); $this->transcodingStreamer->setBitRate($bitRate ?: config('koel.streaming.bitrate')); $this->transcodingStreamer->setStartTime($startTime); return $this->transcodingStreamer; } $this->directStreamer->setSong($song); return $this->directStreamer; } }