song->path, 'application/octet-stream'); (new ResourceServlet($resource))->sendResource($rangeSet); } catch (InvalidRangeHeaderException $e) { abort(400); } catch (UnsatisfiableRangeException $e) { abort(416); } catch (NonExistentFileException $e) { abort(404); } catch (UnreadableFileException $e) { abort(500); } catch (SendFileFailureException $e) { abort_unless(headers_sent(), 500); echo "An error occurred while attempting to send the requested resource: {$e->getMessage()}"; } exit; } }