screen-recorder 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +7 -0
- data/lib/screen-recorder.rb +1 -0
- data/lib/screen-recorder/common.rb +0 -22
- data/lib/screen-recorder/desktop.rb +2 -0
- data/lib/screen-recorder/screenshot.rb +39 -0
- data/lib/screen-recorder/version.rb +1 -1
- data/lib/screen-recorder/window.rb +2 -0
- data/screen-recorder.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45346a64b3fbf881ad0e84d86b60071870c88ceb4903c887b8986523cd9cbc54
|
4
|
+
data.tar.gz: 9534f82f4a2f777beedd390f4bc684947f5a1439eb0c7cd197d4a5fca53a87ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b41efb69403ff6739d94f43a663366fb50532bf5289b62fcdea478539299d7e1031f492ae0bda43db8a5e228b42205c585e9e9e29b85609e0eebda283b0c151b
|
7
|
+
data.tar.gz: 00f30237b8c76aa88ee19333c2c84cb43e9170bc0df3caa6b89a0591b78852ef4483709dbe00869c4672ef754ef8fa67f626ad42593a797eef4e653848217317
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
This project adheres to [Semantic Versioning](https://semver.org/).
|
4
4
|
|
5
|
+
### 1.6.0 (2021-08-22)
|
6
|
+
* Match "childprocess" gem version to `selenium-webdriver`. Closes [#99](https://github.com/kapoorlakshya/screen-recorder/issues/99).
|
7
|
+
* Add support for screenshot resolution. Closes [#98](https://github.com/kapoorlakshya/screen-recorder/issues/98).
|
8
|
+
|
5
9
|
### 1.5.0 (2021-03-23)
|
6
10
|
* Relax "os" gem version to minor level ([#97](https://github.com/kapoorlakshya/screen-recorder/pull/97)). Thanks, [hlascelles](https://github.com/hlascelles)!
|
7
11
|
|
data/README.md
CHANGED
@@ -166,6 +166,13 @@ window_title = ScreenRecorder::('chrome').first
|
|
166
166
|
@recorder.screenshot('after-recording.png')
|
167
167
|
browser.quit
|
168
168
|
```
|
169
|
+
|
170
|
+
You can even specify a custom capture resolution:
|
171
|
+
|
172
|
+
```rb
|
173
|
+
@recorder.screenshot('screenshot.png', '1024x768')
|
174
|
+
```
|
175
|
+
|
169
176
|
#### Video Output
|
170
177
|
|
171
178
|
Once the recorder is stopped, you can view the video metadata or transcode
|
data/lib/screen-recorder.rb
CHANGED
@@ -40,20 +40,6 @@ module ScreenRecorder
|
|
40
40
|
@video = prepare_video unless exit_code == 1
|
41
41
|
end
|
42
42
|
|
43
|
-
#
|
44
|
-
# Takes a screenshot in the current context (input) - desktop or current window
|
45
|
-
#
|
46
|
-
def screenshot(filename)
|
47
|
-
process = execute_command(screenshot_cmd(filename))
|
48
|
-
exit_code = wait_for_process_exit(process) # 0 (success) or 1 (fail)
|
49
|
-
if exit_code&.zero?
|
50
|
-
ScreenRecorder.logger.info "Screenshot: #{filename}"
|
51
|
-
return filename
|
52
|
-
end
|
53
|
-
ScreenRecorder.logger.error 'Failed to take a screenshot.'
|
54
|
-
nil
|
55
|
-
end
|
56
|
-
|
57
43
|
#
|
58
44
|
# Discards the recorded file. Useful in automated testing
|
59
45
|
# when a test passes and the recorded file is no longer
|
@@ -124,14 +110,6 @@ module ScreenRecorder
|
|
124
110
|
"#{ffmpeg_bin} #{@options.parsed}"
|
125
111
|
end
|
126
112
|
|
127
|
-
#
|
128
|
-
# Parameters to capture a single frame
|
129
|
-
#
|
130
|
-
def screenshot_cmd(filename)
|
131
|
-
# -f overwrites existing file
|
132
|
-
"#{ffmpeg_bin} -f #{options.capture_device} -i #{options.input} -framerate 1 -frames:v 1 #{filename}"
|
133
|
-
end
|
134
|
-
|
135
113
|
#
|
136
114
|
# Returns true if ffmpeg binary is found.
|
137
115
|
#
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module ScreenRecorder
|
2
|
+
# All screenshot related code
|
3
|
+
module Screenshot
|
4
|
+
#
|
5
|
+
# Takes a screenshot in the current context (input) - desktop or current window
|
6
|
+
#
|
7
|
+
def screenshot(filename, resolution = nil)
|
8
|
+
ScreenRecorder.logger.debug "Screenshot filename: #{filename}, resolution: #{resolution}"
|
9
|
+
cmd = screenshot_cmd(filename: filename, resolution: resolution)
|
10
|
+
process = execute_command(cmd)
|
11
|
+
exit_code = wait_for_process_exit(process) # 0 (success) or 1 (fail)
|
12
|
+
if exit_code&.zero?
|
13
|
+
ScreenRecorder.logger.info "Screenshot: #{filename}"
|
14
|
+
return filename
|
15
|
+
end
|
16
|
+
ScreenRecorder.logger.error 'Failed to take a screenshot.'
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# Parameters to capture a single frame
|
22
|
+
#
|
23
|
+
def screenshot_cmd(filename:, resolution: nil)
|
24
|
+
resolution = resolution ? resolution_arg(resolution) : nil
|
25
|
+
# -f overwrites existing file
|
26
|
+
"#{ffmpeg_bin} -f #{options.capture_device} -i #{options.input} -framerate 1 -frames:v 1 #{resolution}#{filename}"
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
#
|
32
|
+
# Returns OS specific video resolution arg for ffmpeg
|
33
|
+
#
|
34
|
+
def resolution_arg(size)
|
35
|
+
# macOS likes -s, windows and linux like -video_size
|
36
|
+
OS.mac? ? "-s #{size} " : "-video_size #{size} "
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/screen-recorder.gemspec
CHANGED
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency 'watir', '~> 6.0'
|
39
39
|
spec.add_development_dependency 'webdrivers', '~> 4.0'
|
40
40
|
|
41
|
-
spec.add_runtime_dependency 'childprocess', '>= 1.0', '<
|
41
|
+
spec.add_runtime_dependency 'childprocess', '>= 1.0', '< 5.0' # Roughly match Selenium
|
42
42
|
spec.add_runtime_dependency 'os', '~> 1.0'
|
43
43
|
spec.add_runtime_dependency 'streamio-ffmpeg', '~> 3.0'
|
44
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: screen-recorder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lakshya Kapoor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -145,7 +145,7 @@ dependencies:
|
|
145
145
|
version: '1.0'
|
146
146
|
- - "<"
|
147
147
|
- !ruby/object:Gem::Version
|
148
|
-
version: '
|
148
|
+
version: '5.0'
|
149
149
|
type: :runtime
|
150
150
|
prerelease: false
|
151
151
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -155,7 +155,7 @@ dependencies:
|
|
155
155
|
version: '1.0'
|
156
156
|
- - "<"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
158
|
+
version: '5.0'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: os
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- lib/screen-recorder/desktop.rb
|
210
210
|
- lib/screen-recorder/errors.rb
|
211
211
|
- lib/screen-recorder/options.rb
|
212
|
+
- lib/screen-recorder/screenshot.rb
|
212
213
|
- lib/screen-recorder/titles.rb
|
213
214
|
- lib/screen-recorder/type_checker.rb
|
214
215
|
- lib/screen-recorder/version.rb
|
@@ -219,8 +220,8 @@ licenses:
|
|
219
220
|
- MIT
|
220
221
|
metadata:
|
221
222
|
changelog_uri: https://github.com/kapoorlakshya/screen-recorder/blob/master/CHANGELOG.md
|
222
|
-
source_code_uri: https://github.com/kapoorlakshya/screen-recorder/tree/v1.
|
223
|
-
documentation_uri: https://www.rubydoc.info/gems/screen-recorder/1.
|
223
|
+
source_code_uri: https://github.com/kapoorlakshya/screen-recorder/tree/v1.6.0
|
224
|
+
documentation_uri: https://www.rubydoc.info/gems/screen-recorder/1.6.0
|
224
225
|
bug_tracker_uri: https://github.com/kapoorlakshya/screen-recorder/issues
|
225
226
|
wiki_uri: https://github.com/kapoorlakshya/screen-recorder/wiki
|
226
227
|
post_install_message:
|