2015-12-13 04:42:28 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Streamers;
|
|
|
|
|
2015-12-27 13:29:03 +00:00
|
|
|
use App\Models\Song;
|
|
|
|
|
2016-02-02 08:01:47 +00:00
|
|
|
class XSendFileStreamer extends Streamer implements StreamerInterface
|
2015-12-13 04:42:28 +00:00
|
|
|
{
|
2015-12-27 13:29:03 +00:00
|
|
|
public function __construct(Song $song)
|
2015-12-13 04:42:28 +00:00
|
|
|
{
|
2015-12-27 13:29:03 +00:00
|
|
|
parent::__construct($song);
|
2015-12-13 04:42:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
}
|