@uppy/webcam
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -64,3 +64,3 @@ "use strict"; | ||
const shouldShowSnapshotButton = !hasRecordedVideo && isModeAvailable(modes, 'picture'); | ||
const shouldShowRecordingLength = supportsRecording && showRecordingLength; | ||
const shouldShowRecordingLength = supportsRecording && showRecordingLength && !hasRecordedVideo; | ||
const shouldShowVideoSourceDropdown = showVideoSourceDropdown && videoSources && videoSources.length > 1; | ||
@@ -115,5 +115,5 @@ const videoProps = { | ||
i18n: i18n | ||
})), shouldShowRecordingLength && h("div", { | ||
})), h("div", { | ||
className: "uppy-Webcam-recordingLength" | ||
}, h(RecordingLength, { | ||
}, shouldShowRecordingLength && h(RecordingLength, { | ||
recordingLengthSeconds: recordingLengthSeconds, | ||
@@ -120,0 +120,0 @@ i18n: i18n |
@@ -7,8 +7,9 @@ "use strict"; | ||
function DiscardButton({ | ||
onDiscard, | ||
i18n | ||
}) { | ||
function DiscardButton(_ref) { | ||
let { | ||
onDiscard, | ||
i18n | ||
} = _ref; | ||
return h("button", { | ||
className: "uppy-u-reset uppy-c-btn uppy-Webcam-button", | ||
className: "uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--discard", | ||
type: "button", | ||
@@ -15,0 +16,0 @@ title: i18n('discardRecordedFile'), |
@@ -34,2 +34,4 @@ "use strict"; | ||
const PermissionsScreen = require('./PermissionsScreen'); | ||
const locale = require('./locale.js'); | ||
/** | ||
@@ -122,19 +124,3 @@ * Normalize a MIME type or file extension into a MIME type. | ||
this.defaultLocale = { | ||
strings: { | ||
pluginNameCamera: 'Camera', | ||
smile: 'Smile!', | ||
takePicture: 'Take a picture', | ||
startRecording: 'Begin video recording', | ||
stopRecording: 'Stop video recording', | ||
allowAccessTitle: 'Please allow access to your camera', | ||
allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.', | ||
noCameraTitle: 'Camera Not Available', | ||
noCameraDescription: 'In order to take pictures or record video, please connect a camera device', | ||
recordingStoppedMaxSize: 'Recording stopped because the file size is about to exceed the limit', | ||
recordingLength: 'Recording length %{recording_length}', | ||
submitRecordedFile: 'Submit recorded file', | ||
discardRecordedFile: 'Discard recorded file' | ||
} | ||
}; // set default options | ||
this.defaultLocale = locale; // set default options | ||
@@ -211,3 +197,7 @@ const defaultOptions = { | ||
getConstraints(deviceId = null) { | ||
getConstraints(deviceId) { | ||
if (deviceId === void 0) { | ||
deviceId = null; | ||
} | ||
const acceptsAudio = this.opts.modes.indexOf('video-audio') !== -1 || this.opts.modes.indexOf('audio-only') !== -1; | ||
@@ -232,3 +222,7 @@ const acceptsVideo = !this.isAudioOnly() && (this.opts.modes.indexOf('video-audio') !== -1 || this.opts.modes.indexOf('video-only') !== -1 || this.opts.modes.indexOf('picture') !== -1); | ||
start(options = null) { | ||
start(options) { | ||
if (options === void 0) { | ||
options = null; | ||
} | ||
if (!this.supportsUserMedia) { | ||
@@ -691,2 +685,2 @@ return Promise.reject(new Error('Webcam access not supported')); | ||
}), _class.VERSION = "2.0.4", _temp); | ||
}), _class.VERSION = "2.0.5", _temp); |
@@ -7,8 +7,10 @@ "use strict"; | ||
module.exports = function RecordButton({ | ||
recording, | ||
onStartRecording, | ||
onStopRecording, | ||
i18n | ||
}) { | ||
module.exports = function RecordButton(_ref) { | ||
let { | ||
recording, | ||
onStartRecording, | ||
onStopRecording, | ||
i18n | ||
} = _ref; | ||
if (recording) { | ||
@@ -15,0 +17,0 @@ return h("button", { |
@@ -9,6 +9,7 @@ "use strict"; | ||
module.exports = function RecordingLength({ | ||
recordingLengthSeconds, | ||
i18n | ||
}) { | ||
module.exports = function RecordingLength(_ref) { | ||
let { | ||
recordingLengthSeconds, | ||
i18n | ||
} = _ref; | ||
const formattedRecordingLengthSeconds = formatSeconds(recordingLengthSeconds); | ||
@@ -15,0 +16,0 @@ return h("span", { |
@@ -9,6 +9,7 @@ "use strict"; | ||
module.exports = ({ | ||
onSnapshot, | ||
i18n | ||
}) => { | ||
module.exports = _ref => { | ||
let { | ||
onSnapshot, | ||
i18n | ||
} = _ref; | ||
return h("button", { | ||
@@ -15,0 +16,0 @@ className: "uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture", |
@@ -7,6 +7,7 @@ "use strict"; | ||
function SubmitButton({ | ||
onSubmit, | ||
i18n | ||
}) { | ||
function SubmitButton(_ref) { | ||
let { | ||
onSubmit, | ||
i18n | ||
} = _ref; | ||
return h("button", { | ||
@@ -13,0 +14,0 @@ className: "uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit", |
@@ -7,7 +7,8 @@ "use strict"; | ||
module.exports = ({ | ||
currentDeviceId, | ||
videoSources, | ||
onChangeVideoSource | ||
}) => { | ||
module.exports = _ref => { | ||
let { | ||
currentDeviceId, | ||
videoSources, | ||
onChangeVideoSource | ||
} = _ref; | ||
return h("div", { | ||
@@ -14,0 +15,0 @@ className: "uppy-Webcam-videoSource" |
{ | ||
"name": "@uppy/webcam", | ||
"description": "Uppy plugin that takes photos or records videos using the device's camera.", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"license": "MIT", | ||
@@ -29,9 +29,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/utils": "^4.0.3", | ||
"@uppy/utils": "^4.0.4", | ||
"preact": "^10.5.13" | ||
}, | ||
"peerDependencies": { | ||
"@uppy/core": "^2.0.0" | ||
}, | ||
"gitHead": "b8b4127bd55b8e7395889048407c074fce944295" | ||
} | ||
"@uppy/core": "^2.1.3" | ||
} | ||
} |
@@ -52,3 +52,3 @@ /* eslint-disable jsx-a11y/media-has-caption */ | ||
const shouldShowSnapshotButton = !hasRecordedVideo && isModeAvailable(modes, 'picture') | ||
const shouldShowRecordingLength = supportsRecording && showRecordingLength | ||
const shouldShowRecordingLength = supportsRecording && showRecordingLength && !hasRecordedVideo | ||
const shouldShowVideoSourceDropdown = showVideoSourceDropdown && videoSources && videoSources.length > 1 | ||
@@ -109,7 +109,7 @@ | ||
{shouldShowRecordingLength && ( | ||
<div className="uppy-Webcam-recordingLength"> | ||
<div className="uppy-Webcam-recordingLength"> | ||
{shouldShowRecordingLength && ( | ||
<RecordingLength recordingLengthSeconds={recordingLengthSeconds} i18n={i18n} /> | ||
</div> | ||
)} | ||
)} | ||
</div> | ||
</div> | ||
@@ -116,0 +116,0 @@ </div> |
@@ -6,3 +6,3 @@ const { h } = require('preact') | ||
<button | ||
className="uppy-u-reset uppy-c-btn uppy-Webcam-button" | ||
className="uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--discard" | ||
type="button" | ||
@@ -9,0 +9,0 @@ title={i18n('discardRecordedFile')} |
@@ -10,4 +10,4 @@ /** | ||
return `${Math.floor( | ||
seconds / 60 | ||
seconds / 60, | ||
)}:${String(seconds % 60).padStart(2, 0)}` | ||
} |
@@ -11,2 +11,3 @@ const { h } = require('preact') | ||
const locale = require('./locale.js') | ||
/** | ||
@@ -79,19 +80,3 @@ * Normalize a MIME type or file extension into a MIME type. | ||
this.defaultLocale = { | ||
strings: { | ||
pluginNameCamera: 'Camera', | ||
smile: 'Smile!', | ||
takePicture: 'Take a picture', | ||
startRecording: 'Begin video recording', | ||
stopRecording: 'Stop video recording', | ||
allowAccessTitle: 'Please allow access to your camera', | ||
allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.', | ||
noCameraTitle: 'Camera Not Available', | ||
noCameraDescription: 'In order to take pictures or record video, please connect a camera device', | ||
recordingStoppedMaxSize: 'Recording stopped because the file size is about to exceed the limit', | ||
recordingLength: 'Recording length %{recording_length}', | ||
submitRecordedFile: 'Submit recorded file', | ||
discardRecordedFile: 'Discard recorded file', | ||
}, | ||
} | ||
this.defaultLocale = locale | ||
@@ -98,0 +83,0 @@ // set default options |
@@ -13,3 +13,3 @@ const Uppy = require('@uppy/core') | ||
expect( | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType, | ||
).not.toBeDefined() | ||
@@ -25,3 +25,3 @@ }) | ||
expect( | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType, | ||
).toEqual('video/webm') | ||
@@ -37,3 +37,3 @@ }) | ||
expect( | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType, | ||
).not.toBeDefined() | ||
@@ -51,3 +51,3 @@ }) | ||
expect( | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType, | ||
).toEqual('video/mp4') | ||
@@ -65,3 +65,3 @@ }) | ||
expect( | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType, | ||
).toEqual('video/webm') | ||
@@ -80,3 +80,3 @@ }) | ||
expect( | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType, | ||
).toEqual('video/webm') | ||
@@ -94,3 +94,3 @@ }) | ||
expect( | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType | ||
uppy.getPlugin('Webcam').getMediaRecorderOptions().mimeType, | ||
).toEqual(undefined) | ||
@@ -97,0 +97,0 @@ }) |
/* eslint-disable */ | ||
import type { Locale } from '@uppy/core' | ||
import type { Locale } from '@uppy/core' | ||
type WebcamLocale = Locale< | ||
| 'pluginNameCamera' | ||
type WebcamLocale = Locale< | ||
| 'pluginNameCamera' | ||
| 'noCameraTitle' | ||
| 'noCameraDescription' | ||
| 'recordingStoppedMaxSize' | ||
| 'submitRecordedFile' | ||
| 'discardRecordedFile' | ||
| 'smile' | ||
@@ -10,12 +15,7 @@ | 'takePicture' | ||
| 'stopRecording' | ||
| 'recordingLength' | ||
| 'allowAccessTitle' | ||
| 'allowAccessDescription' | ||
| 'noCameraTitle' | ||
| 'noCameraDescription' | ||
| 'recordingStoppedMaxSize' | ||
| 'recordingLength' | ||
| 'submitRecordedFile' | ||
| 'discardRecordedFile' | ||
> | ||
> | ||
export default WebcamLocale | ||
export default WebcamLocale |
@@ -21,2 +21,3 @@ import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core' | ||
videoConstraints?: MediaTrackConstraints | ||
showRecordingLength?: boolean | ||
} | ||
@@ -23,0 +24,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
145458
52
2119
1
18
Updated@uppy/utils@^4.0.4