New remux feature (fixes #103)

This commit is contained in:
Pierre Rudloff 2017-04-25 00:40:24 +02:00
parent b80b9c7b2e
commit e6bbe54474
6 changed files with 169 additions and 16 deletions

View file

@ -88,7 +88,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
public function testGetURL($url, $format, $filename, $extension, $domain)
{
$videoURL = $this->download->getURL($url, $format);
$this->assertContains($domain, $videoURL);
$this->assertContains($domain, $videoURL[0]);
}
/**
@ -98,7 +98,8 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
*/
public function testGetURLWithPassword()
{
$this->assertContains('vimeocdn.com', $this->download->getURL('http://vimeo.com/68375962', null, 'youtube-dl'));
$videoURL = $this->download->getURL('http://vimeo.com/68375962', null, 'youtube-dl');
$this->assertContains('vimeocdn.com', $videoURL[0]);
}
/**
@ -184,6 +185,23 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
*
* @return array[]
*/
public function remuxUrlProvider()
{
return [
[
'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'bestvideo+bestaudio',
"It's Not Me, It's You - Hearts Under Fire-M7IpKCZ47pU",
'mp4',
'googlevideo.com',
],
];
}
/**
* Provides URLs for remux tests.
*
* @return array[]
*/
public function m3uUrlProvider()
{
return [
@ -390,6 +408,25 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
$this->assertFalse(feof($stream));
}
/**
* Test getRemuxStream function.
*
* @param string $url URL
* @param string $format Format
*
* @return void
* @dataProvider remuxUrlProvider
*/
public function testGetRemuxStream($url, $format)
{
$urls = $this->download->getURL($url, $format);
if (count($urls) > 1) {
$stream = $this->download->getRemuxStream($urls);
$this->assertInternalType('resource', $stream);
$this->assertFalse(feof($stream));
}
}
/**
* Test getRtmpStream function.
*