koel/app/Services/Streamers/XSendFileStreamer.php

19 lines
463 B
PHP
Raw Normal View History

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