2019-04-21 20:56:07 +00:00
|
|
|
<?php
|
2019-10-03 19:41:54 +00:00
|
|
|
|
2019-04-21 20:56:07 +00:00
|
|
|
/**
|
|
|
|
* ConvertedPlaylistArchiveStream class.
|
|
|
|
*/
|
|
|
|
|
2019-04-22 19:06:05 +00:00
|
|
|
namespace Alltube\Stream;
|
2019-04-21 20:56:07 +00:00
|
|
|
|
2020-06-20 23:44:20 +00:00
|
|
|
use Alltube\Library\Exception\AlltubeLibraryException;
|
|
|
|
use Alltube\Library\Video;
|
2019-04-21 20:56:07 +00:00
|
|
|
use Slim\Http\Stream;
|
|
|
|
|
2019-04-21 22:05:53 +00:00
|
|
|
/**
|
|
|
|
* Class used to create a Zip archive from converted playlists entries.
|
|
|
|
*/
|
2019-04-21 20:56:07 +00:00
|
|
|
class ConvertedPlaylistArchiveStream extends PlaylistArchiveStream
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Start streaming a new video.
|
|
|
|
*
|
|
|
|
* @param Video $video Video to stream
|
|
|
|
*
|
|
|
|
* @return void
|
2020-06-20 23:44:20 +00:00
|
|
|
* @throws AlltubeLibraryException
|
2019-04-21 20:56:07 +00:00
|
|
|
*/
|
|
|
|
protected function startVideoStream(Video $video)
|
|
|
|
{
|
2020-06-20 23:44:20 +00:00
|
|
|
$this->curVideoStream = new Stream($this->downloader->getAudioStream($video));
|
2019-04-21 20:56:07 +00:00
|
|
|
|
|
|
|
$this->init_file_stream_transfer(
|
|
|
|
$video->getFileNameWithExtension('mp3'),
|
|
|
|
// The ZIP format does not care about the file size.
|
|
|
|
0
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|