-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScreenCapture plugin for screenshots / screen recordings #2132
Merged
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
dfd1a9b
Finnish locale semantics improved
307ff24
Finnish semantics improved
4188e39
Screen capture initial commit
eab2841
upstream merge
91d73dc
Fix. Removed audio constraint from video.
8d4d722
ui improvements
aa5228f
Merge branch 'master' into pr/2132
arturi da622e4
so Lerna doesn’t try to publish as private
arturi ca37949
refactor, tweak icons
arturi 61d11fc
remove commented code from webcam styles
arturi e7388d9
Check for MediaRecorder (hides button in Safari) and refactor everything
arturi f63c32f
update readme
arturi e3df754
beta for now
arturi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 Transloadit | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# @uppy/webcam | ||
|
||
<img src="https://uppy.io/images/logos/uppy-dog-head-arrow.svg" width="120" alt="Uppy logo: a superman puppy in a pink suit" align="right"> | ||
|
||
<a href="https://www.npmjs.com/package/@uppy/webcam"><img src="https://img.shields.io/npm/v/@uppy/webcam.svg?style=flat-square"></a> | ||
<a href="https://travis-ci.org/transloadit/uppy"><img src="https://img.shields.io/travis/transloadit/uppy/master.svg?style=flat-square" alt="Build Status"></a> | ||
|
||
The Webcam plugin for Uppy lets you take photos and record videos with a built-in camera on desktop and mobile devices. | ||
|
||
Uppy is being developed by the folks at [Transloadit](https://transloadit.com), a versatile file encoding service. | ||
|
||
## Example | ||
|
||
```js | ||
const Uppy = require('@uppy/core') | ||
const Webcam = require('@uppy/webcam') | ||
|
||
const uppy = Uppy() | ||
uppy.use(Webcam, { | ||
mirror: true, | ||
facingMode: 'user' | ||
}) | ||
``` | ||
|
||
## Installation | ||
|
||
```bash | ||
$ npm install @uppy/webcam --save | ||
``` | ||
|
||
We recommend installing from npm and then using a module bundler such as [Webpack](https://webpack.js.org/), [Browserify](http://browserify.org/) or [Rollup.js](http://rollupjs.org/). | ||
|
||
Alternatively, you can also use this plugin in a pre-built bundle from Transloadit's CDN: Edgly. In that case `Uppy` will attach itself to the global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. | ||
|
||
## Documentation | ||
|
||
Documentation for this plugin can be found on the [Uppy website](https://uppy.io/docs/webcam). | ||
|
||
## License | ||
|
||
[The MIT License](./LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@uppy/screen-capture", | ||
"description": "Uppy plugin that captures video from display or application.", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"style": "dist/style.min.css", | ||
"types": "types/index.d.ts", | ||
"keywords": [ | ||
"file uploader", | ||
"uppy", | ||
"uppy-plugin", | ||
"screen capture", | ||
"video", | ||
"record", | ||
"mediarecorder" | ||
], | ||
"homepage": "https://uppy.io", | ||
"bugs": { | ||
"url": "https://github.com/transloadit/uppy/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/transloadit/uppy.git" | ||
}, | ||
"dependencies": { | ||
"@uppy/utils": "file:../utils", | ||
"preact": "8.2.9" | ||
}, | ||
"peerDependencies": { | ||
"@uppy/core": "^1.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const { h, Component } = require('preact') | ||
const RecordButton = require('./RecordButton') | ||
const SubmitButton = require('./SubmitButton') | ||
const StopWatch = require('./StopWatch') | ||
const StreamStatus = require('./StreamStatus') | ||
|
||
class RecorderScreen extends Component { | ||
componentWillUnmount () { | ||
this.props.onStop() | ||
} | ||
|
||
render () { | ||
const { recording, stream: videoStream, recordedVideo } = this.props | ||
|
||
const videoProps = { | ||
playsinline: true | ||
} | ||
|
||
// show stream | ||
if (recording || (!recordedVideo && !recording)) { | ||
videoProps.muted = true | ||
videoProps.autoplay = true | ||
videoProps.srcObject = videoStream | ||
} | ||
|
||
// show preview | ||
if (recordedVideo && !recording) { | ||
videoProps.muted = false | ||
videoProps.controls = true | ||
videoProps.src = recordedVideo | ||
|
||
// reset srcObject in dom. If not resetted, stream sticks in element | ||
if (this.videoElement) { | ||
this.videoElement.srcObject = undefined | ||
} | ||
} | ||
|
||
return ( | ||
<div class="uppy uppy-ScreenCapture-container"> | ||
<div class="uppy-ScreenCapture-videoContainer"> | ||
<StreamStatus {...this.props} /> | ||
<video ref={videoElement => (this.videoElement = videoElement)} class="uppy-ScreenCapture-video" {...videoProps} /> | ||
<StopWatch {...this.props} /> | ||
</div> | ||
|
||
<div class="uppy-ScreenCapture-buttonContainer"> | ||
<RecordButton {...this.props} /> | ||
<SubmitButton {...this.props} /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
module.exports = RecorderScreen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const { h } = require('preact') | ||
|
||
/** | ||
* Control screen capture recording. Will show record or stop button. | ||
*/ | ||
module.exports = function RecordButton ({ recording, onStartRecording, onStopRecording, i18n }) { | ||
if (recording) { | ||
return ( | ||
<button | ||
class="uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video uppy-ScreenCapture-button--stop-rec" | ||
type="button" | ||
title={i18n('stopRecording')} | ||
aria-label={i18n('stopRecording')} | ||
onclick={onStopRecording} | ||
data-uppy-super-focusable | ||
> | ||
<svg aria-hidden="true" focusable="false" class="UppyIcon" width="100" height="100" viewBox="0 0 100 100"> | ||
<rect x="15" y="15" width="70" height="70" /> | ||
</svg> | ||
</button> | ||
) | ||
} | ||
|
||
return ( | ||
<button | ||
class="uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video" | ||
type="button" | ||
title={i18n('startCapturing')} | ||
aria-label={i18n('stopCapturing')} | ||
onclick={onStartRecording} | ||
data-uppy-super-focusable | ||
> | ||
<svg aria-hidden="true" focusable="false" class="UppyIcon" width="100" height="100" viewBox="0 0 100 100"> | ||
<circle cx="50" cy="50" r="40" /> | ||
</svg> | ||
</button> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const { h } = require('preact') | ||
|
||
module.exports = () => { | ||
return ( | ||
<svg aria-hidden="true" focusable="false" width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"> | ||
<g fill="none" fill-rule="evenodd"> | ||
<rect fill="#2C3E50" width="32" height="32" rx="16" /> | ||
<path d="M24.182 9H7.818C6.81 9 6 9.742 6 10.667v10c0 .916.81 1.666 1.818 1.666h4.546V24h7.272v-1.667h4.546c1 0 1.809-.75 1.809-1.666l.009-10C26 9.742 25.182 9 24.182 9zM24 21H8V11h16v10z" fill="#FFF" fill-rule="nonzero" /> | ||
<circle fill="#FFF" cx="16" cy="16" r="2" /> | ||
</g> | ||
</svg> | ||
) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add
so npm doesn't try to create a private package once this is published for the first time (which would fail the lerna publish midway)