Socket
Socket
Sign inDemoInstall

@uppy/webcam

Package Overview
Dependencies
Maintainers
5
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/webcam - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

lib/formatSeconds.js

5

lib/CameraScreen.js

@@ -11,2 +11,4 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }

var RecordingLength = require('./RecordingLength');
function isModeAvailable(modes, mode) {

@@ -38,2 +40,3 @@ return modes.indexOf(mode) !== -1;

var shouldShowSnapshotButton = isModeAvailable(this.props.modes, 'picture');
var shouldShowRecordingLength = this.props.supportsRecording && this.props.showRecordingLength;
return h("div", {

@@ -51,3 +54,3 @@ class: "uppy uppy-Webcam-container"

class: "uppy-Webcam-buttonContainer"
}, shouldShowSnapshotButton ? SnapshotButton(this.props) : null, ' ', shouldShowRecordButton ? RecordButton(this.props) : null));
}, shouldShowRecordingLength ? RecordingLength(this.props) : null, ' ', shouldShowSnapshotButton ? SnapshotButton(this.props) : null, ' ', shouldShowRecordButton ? RecordButton(this.props) : null));
};

@@ -54,0 +57,0 @@

37

lib/index.js

@@ -80,6 +80,7 @@ var _class, _temp;

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.'
} // set default options
allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.',
recordingLength: 'Recording length %{recording_length}'
}
}; // set default options
};
var defaultOptions = {

@@ -93,3 +94,4 @@ onBeforeSnapshot: function onBeforeSnapshot() {

facingMode: 'user',
preferredVideoMimeType: null
preferredVideoMimeType: null,
showRecordingLength: false
};

@@ -190,2 +192,14 @@ _this.opts = _extends({}, defaultOptions, {}, opts);

this.recorder.start();
if (this.opts.showRecordingLength) {
// Start the recordingLengthTimer if we are showing the recording length.
this.recordingLengthTimer = setInterval(function () {
var currentRecordingLength = _this3.getPluginState().recordingLengthSeconds;
_this3.setPluginState({
recordingLengthSeconds: currentRecordingLength + 1
});
}, 1000);
}
this.setPluginState({

@@ -205,2 +219,11 @@ isRecording: true

_this4.recorder.stop();
if (_this4.opts.showRecordingLength) {
// Stop the recordingLengthTimer if we are showing the recording length.
clearInterval(_this4.recordingLengthTimer);
_this4.setPluginState({
recordingLengthSeconds: 0
});
}
});

@@ -406,2 +429,3 @@ return stopped.then(function () {

modes: this.opts.modes,
showRecordingLength: this.opts.showRecordingLength,
supportsRecording: supportsMediaRecorder(),

@@ -416,3 +440,4 @@ recording: webcamState.isRecording,

this.setPluginState({
cameraReady: false
cameraReady: false,
recordingLengthSeconds: 0
});

@@ -435,2 +460,2 @@ var target = this.opts.target;

return Webcam;
}(Plugin), _class.VERSION = "1.4.0", _temp);
}(Plugin), _class.VERSION = "1.5.0", _temp);
{
"name": "@uppy/webcam",
"description": "Uppy plugin that takes photos or records videos using the device's camera.",
"version": "1.4.0",
"version": "1.5.0",
"license": "MIT",

@@ -29,3 +29,3 @@ "main": "lib/index.js",

"dependencies": {
"@uppy/utils": "^2.1.0",
"@uppy/utils": "^2.1.1",
"preact": "8.2.9"

@@ -36,3 +36,3 @@ },

},
"gitHead": "c370dba0b6d48770995d0c764bb54f0b05309781"
"gitHead": "18180d577854d1a78588d67eb210528b207bf130"
}

@@ -21,3 +21,4 @@ # @uppy/webcam

mirror: true,
facingMode: 'user'
facingMode: 'user',
showRecordingLength: true
})

@@ -24,0 +25,0 @@ ```

const { h, Component } = require('preact')
const SnapshotButton = require('./SnapshotButton')
const RecordButton = require('./RecordButton')
const RecordingLength = require('./RecordingLength')

@@ -25,2 +26,3 @@ function isModeAvailable (modes, mode) {

const shouldShowSnapshotButton = isModeAvailable(this.props.modes, 'picture')
const shouldShowRecordingLength = this.props.supportsRecording && this.props.showRecordingLength

@@ -33,2 +35,4 @@ return (

<div class="uppy-Webcam-buttonContainer">
{shouldShowRecordingLength ? RecordingLength(this.props) : null}
{' '}
{shouldShowSnapshotButton ? SnapshotButton(this.props) : null}

@@ -35,0 +39,0 @@ {' '}

@@ -57,3 +57,4 @@ const { h } = require('preact')

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.'
allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.',
recordingLength: 'Recording length %{recording_length}'
}

@@ -74,3 +75,4 @@ }

facingMode: 'user',
preferredVideoMimeType: null
preferredVideoMimeType: null,
showRecordingLength: false
}

@@ -174,2 +176,10 @@

if (this.opts.showRecordingLength) {
// Start the recordingLengthTimer if we are showing the recording length.
this.recordingLengthTimer = setInterval(() => {
const currentRecordingLength = this.getPluginState().recordingLengthSeconds
this.setPluginState({ recordingLengthSeconds: currentRecordingLength + 1 })
}, 1000)
}
this.setPluginState({

@@ -186,2 +196,8 @@ isRecording: true

this.recorder.stop()
if (this.opts.showRecordingLength) {
// Stop the recordingLengthTimer if we are showing the recording length.
clearInterval(this.recordingLengthTimer)
this.setPluginState({ recordingLengthSeconds: 0 })
}
})

@@ -375,2 +391,3 @@

modes={this.opts.modes}
showRecordingLength={this.opts.showRecordingLength}
supportsRecording={supportsMediaRecorder()}

@@ -386,3 +403,4 @@ recording={webcamState.isRecording}

this.setPluginState({
cameraReady: false
cameraReady: false,
recordingLengthSeconds: 0
})

@@ -389,0 +407,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc