mirror of
https://github.com/koel/koel
synced 2024-12-23 02:53:20 +00:00
25 lines
564 B
PHP
25 lines
564 B
PHP
<?php
|
|
|
|
namespace App\Http\Streamers;
|
|
|
|
use App\Models\Song;
|
|
|
|
class XSendFileStreamer extends BaseStreamer implements StreamerInterface
|
|
{
|
|
public function __construct(Song $song)
|
|
{
|
|
parent::__construct($song);
|
|
}
|
|
|
|
/**
|
|
* Stream the current song using Apache's x_sendfile module.
|
|
*/
|
|
public function stream()
|
|
{
|
|
header("X-Sendfile: {$this->song->path}");
|
|
header("Content-Type: {$this->contentType}");
|
|
header('Content-Disposition: inline; filename="'.basename($this->song->path).'"');
|
|
|
|
exit;
|
|
}
|
|
}
|