2015-12-13 12:42:28 +08:00
|
|
|
<?php
|
|
|
|
|
2017-04-20 19:20:32 +08:00
|
|
|
namespace App\Services\Streamers;
|
2015-12-13 12:42:28 +08:00
|
|
|
|
2018-08-22 19:59:14 +02:00
|
|
|
class XSendFileStreamer extends Streamer implements DirectStreamerInterface
|
2015-12-13 12:42:28 +08:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Stream the current song using Apache's x_sendfile module.
|
|
|
|
*/
|
2018-08-24 17:27:19 +02:00
|
|
|
public function stream(): void
|
2015-12-13 12:42:28 +08:00
|
|
|
{
|
|
|
|
header("X-Sendfile: {$this->song->path}");
|
|
|
|
header("Content-Type: {$this->contentType}");
|
|
|
|
header('Content-Disposition: inline; filename="'.basename($this->song->path).'"');
|
|
|
|
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|