Recommend this page to a friend! |
Download |
Info | Example | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
73% | Total: 495 | All time: 5,859 This week: 54 |
Version | License | PHP version | Categories | |||
phpscreenrecorder 1.0.1 | MIT/X Consortium ... | 5 | PHP 5, Graphics, Debug, Audio, Video |
Description | Author | |||
This class can capture videos of the current screen with ffmpeg. Innovation Award
|
I need a PHP screen recorder class?
PHP Screen Recorder
<?php |
A lightweight php wrapper around ffmpeg to record the screen, best for recording your acceptance tests using selenium, it's easy to use and clean OOP interface.
I was given a task to make an acceptance test suite which included recording videos of the tests. I was using selenium for the task and for the video recording, however, I was unable to find an elegant solution which is why i created this library.
One of the best features of this library is its ease of use.
The startRecording
method is called when the user wants to start the recording
after which this library will start the video recording in the background.
When the user has completed their task they can call stopRecording
to stop the recording .
The library is easily installed as a package through composer:
composer require dawood/phpscreenrecorder
that's it, nothing else is required for the installation
There are examples provided in examples folder as well.
Make sure, that you include the composer autoloader somewhere in your codebase.
include "../vendor/autoload.php";
use dawood\PhpScreenRecorder\ScreenRecorder;
$screenRecorder=new ScreenRecorder();
$screenRecorder->setScreenSizeToCapture(1920,1080);
$screenRecorder->startRecording(__DIR__.DIRECTORY_SEPARATOR.'myVideo');
sleep(5+2);//doing random stuff
//when done stop recording
$screenRecorder->stopRecording();
print "video is saved at :\"".$screenRecorder->getVideo().'"'.PHP_EOL;
public function testLoginUserCorrectly()
{
$this->screenRecorder->setScreenSizeToCapture(1920,1080);
$this->screenRecorder->startRecording(__DIR__."/videos/loginCorrectly.flv",2);
$loginInput = [
'username' => 'test',
'password' => 'password'
];
$this->visit('/')
->submitForm("#loginform > form",$loginInput)
->wait(3)
->see("Logout")
->wait(2);
$this->screenRecorder->stopRecording(0);
}
The ffmpeg
shell command can accept different options:
for a complete list of options you can visit:
http://ffmpeg.org/ffmpeg.html
* setOptions
accepts the options in the array. You can provide any option in following way:
$options['-show_region'=>'1']
$screenRecorder->setOptions($options);
> Note: you have to write complete option including "-" , i had to do this way because there are some options which need "-" this and some which not so it's difficult to know for which option i have to set that that's why you have to provide complete option.
The PHP Screen Recorder is open-sourced software licensed under the MIT license.
Thanks to all of the contributors , fork this repository and send me a pull request
Dawood Ikhlaq and Open source community
Files (6) |
File | Role | Description | ||
---|---|---|---|---|
examples (1 file) | ||||
src (1 file) | ||||
tests (1 file) | ||||
composer.json | Data | Auxiliary data | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | User Comments (3) | |||||||||||||||||||||||||||||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.