Skip to content

Commit 994c902

Browse files
daudmalik06dawood Ikhlaq
authored andcommitted
initialize the project , with all basic working ,tests etc
0 parents  commit 994c902

File tree

10 files changed

+1979
-0
lines changed

10 files changed

+1979
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
vendor

README.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
PHP Screen Recorder
2+
===============
3+
4+
A slim php wrapper around [ffmpeg](https://ffmpeg.org/) to record screen,best for recording your
5+
acceptance test using selenium, easy to use and clean OOP interface.
6+
7+
8+
## History
9+
i had give a task to make **acceptance test suite** but also to record the videos of those
10+
tests , i was using **selenium** to do that task and for video i was not able to find
11+
any elegant solution that's why i created this library.
12+
13+
14+
## Usage
15+
16+
it's so easy to use this library,
17+
You have to call the method `startRecording` when you want to start the recording
18+
then this library will start the recording in the background
19+
and when you done your task you can call `stopRecording` to stop the recording .
20+
21+
## Installation
22+
it's so easy to install this library
23+
Install the package through [composer](http://getcomposer.org):
24+
25+
```
26+
composer require dawood/phpscreenrecorder
27+
```
28+
*that's it you're done nothing else to install*
29+
30+
31+
32+
## Examples
33+
There is an examples provided in examples folder too
34+
35+
Make sure, that you include the composer [autoloader](https://getcomposer.org/doc/01-basic-usage.md#autoloading)
36+
somewhere in your codebase.
37+
38+
39+
### Capture the screen
40+
41+
```php
42+
43+
include "../vendor/autoload.php";
44+
45+
use dawood\PhpScreenRecorder\ScreenRecorder;
46+
47+
$screenRecorder=new ScreenRecorder();
48+
$screenRecorder->setScreenSizeToCapture(1920,1080);
49+
50+
$screenRecorder->startRecording(__DIR__.DIRECTORY_SEPARATOR.'myVideo');
51+
sleep(5+2);//doing random stuff
52+
//when done stop recording
53+
$screenRecorder->stopRecording();
54+
55+
print "video is saved at :\"".$screenRecorder->getVideo().'"'.PHP_EOL;
56+
57+
```
58+
59+
60+
## Setting options
61+
62+
The `ffmpeg` shell command accepts different types of options:
63+
for complete list of options you can visit
64+
http://ffmpeg.org/ffmpeg.html
65+
66+
67+
68+
### Wrapper Methods
69+
70+
71+
* `setOptions` accepts the options in array you can provide any option in following way.
72+
```php
73+
$options['-show_region'=>'1']
74+
$screenRecorder->setOptions($options);
75+
```
76+
> Note: you have to write complete option including "-" ,
77+
i had to do this way because there are some options which need "-" this and some which not
78+
so it's difficult to know for which option i have to set that
79+
that's why you have to provide complete option.
80+
81+
* `setScreenSizeToCapture` screen size to capture it accepts two arguments first width and second height.
82+
83+
84+
* `startRecording` call this method when you have already set all the desired options,
85+
this will start recording the screen.
86+
* `stopRecording` this will stop recording the screen.
87+
88+
* `getVideo` returns the saved video file.
89+
90+
* `setBinary` for this library you don't need any binary file it comes with everything.
91+
but in any case you need to use some other binary you can provide it using this method.
92+
93+
* `getCommandToRun` returns the generated command that will be executed by library ,
94+
this is useful to check how you have set the options or to debug.
95+
96+
97+
* `getOptions` returns array of all the set options.
98+
99+
* `getBinary` returns the currently set binary file i.e ffmpeg.
100+
101+
102+
103+
104+
## License
105+
The **PHP Screen Recorder** is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
106+
107+
## Contribution
108+
Thanks to all of the contributors ,
109+
fork this repository and send me a pull request
110+
111+
## Author
112+
Dawood Ikhlaq and Open source community

composer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "dawood/phpscreenrecorder",
3+
"description": "A slim PHP wrapper around ffmpeg to record screen,best for recording your acceptance test using selenium, easy to use and clean OOP interface",
4+
"type": "library",
5+
"license": "MIT",
6+
"keywords": ["shell","php","selenium","chrome","video","recording"],
7+
"authors": [
8+
{
9+
"name": "Dawood Ikhlaq",
10+
"email": "daudmalik06@gmail.com"
11+
}
12+
],
13+
"minimum-stability": "stable",
14+
"require": {
15+
"symfony/process": "^3.3"
16+
},
17+
"autoload": {
18+
"psr-4": {
19+
"dawood\\PhpScreenRecorder\\": "src/"
20+
}
21+
},
22+
"require-dev": {
23+
"phpunit/phpunit": "^6.2"
24+
}
25+
}

0 commit comments

Comments
 (0)