s3_params) { return (new S3Streamer($song))->stream(); } // If `transcode` parameter isn't passed, the default is to only transcode FLAC. if ($transcode === null && ends_with(mime_content_type($song->path), 'flac')) { $transcode = true; } $streamer = null; if ($transcode) { $streamer = new TranscodingStreamer( $song, $bitRate ?: config('koel.streaming.bitrate'), floatval($request->time) ); } else { switch (config('koel.streaming.method')) { case 'x-sendfile': $streamer = new XSendFileStreamer($song); break; case 'x-accel-redirect': $streamer = new XAccelRedirectStreamer($song); break; default: $streamer = new PHPStreamer($song); break; } } $streamer->stream(); } /** * Get extra information about a song via Last.fm. * * @param Song $song * * @return \Illuminate\Http\JsonResponse */ public function show(Song $song) { return response()->json([ 'lyrics' => $song->lyrics, 'album_info' => $song->album->getInfo(), 'artist_info' => $song->artist->getInfo(), 'youtube' => $song->getRelatedYouTubeVideos(), ]); } /** * Update songs info. * * @param SongUpdateRequest $request * * @return \Illuminate\Http\JsonResponse */ public function update(SongUpdateRequest $request) { return response()->json(Song::updateInfo($request->songs, $request->data)); } }