Skip to content

Commit

Permalink
Mis-spellings:: onProgress miss to onPregress
Browse files Browse the repository at this point in the history
  • Loading branch information
BPing committed Jun 28, 2017
1 parent 81b0e33 commit 7dbc2e4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/FFMpegPush/Example/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

$pushCmd = PushVideo::create();

$pushCmd->onPregress(function ($percent,$remaining,$rate) {
$pushCmd->onProgress(function ($percent,$remaining,$rate) {
// var_dump(func_get_args());
echo "progress:$percent% remaining:$remaining(s) rate:$rate(kb/s)\n";
});
Expand Down
5 changes: 3 additions & 2 deletions src/FFMpegPush/PushInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* -re -ss -i inputpath
*
* Class PushInput
*
* @package FFMpegPush
*/
class PushInput
Expand Down Expand Up @@ -58,7 +59,7 @@ public function setInputVideo($inputVideo)
*/
public function setStartTime($startTime)
{
$this->$startTime = $startTime;
$this->startTime = $startTime;
return $this;
}

Expand All @@ -81,7 +82,7 @@ public function getInputs()
'info',
'-re',
'-ss',
'' . $this->time,
'' . $this->startTime,
'-i',
$this->inputVideo,
);
Expand Down
6 changes: 4 additions & 2 deletions src/FFMpegPush/PushVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* 推流命令
*
* Class PushVideo
*
* @package FFMpegPush
*/
class PushVideo extends FFMpegCommand
Expand Down Expand Up @@ -58,7 +59,8 @@ public function setOutput(PushOutput $output)

/**
* PushVideo constructor.
* @param array $configuration
*
* @param array $configuration
* @param LoggerInterface|null $logger
*/
public function __construct($configuration = array(), LoggerInterface $logger = null)
Expand Down Expand Up @@ -95,7 +97,7 @@ public static function create($configuration = array(), LoggerInterface $logger
*
* @param callable $listener
*/
public function onPregress(callable $listener)
public function onProgress(callable $listener)
{
$this->progressListener->on('progress', $listener);
}
Expand Down
6 changes: 5 additions & 1 deletion tests/PushVideoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function testPush()
$pushCmd = PushVideo::create();

$debugListener = new LineListener();
$pushCmd->addListerner($debugListener);
$pushCmd->addListener($debugListener);
$lastStr = LastMsg::create();
$debugListener->on('debug', function ($line) use ($lastStr) {
if (is_string($line) && '' !== $line && "" !== $line) {
Expand All @@ -27,6 +27,10 @@ public function testPush()
return;
});

$pushCmd->onProgress(function ($percent,$remaining,$rate) {
echo "progress:$percent% remaining:$remaining(s) rate:$rate(kb/s)\n";
});

$pushCmd->setInput(PushInput::create()->setInputVideo('res/test.mp4'))
->setFormat(PushFormat::create())
->setOutput(PushOutput::create()->setPushUrl($pushUrl))
Expand Down

0 comments on commit 7dbc2e4

Please sign in to comment.