Socket
Socket
Sign inDemoInstall

@uppy/webcam

Package Overview
Dependencies
11
Maintainers
5
Versions
89
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.3.6 to 3.4.0

src/CameraIcon.tsx

8

CHANGELOG.md
# @uppy/webcam
## 3.4.0
Released: 2024-03-27
Included in: Uppy v3.24.0
- @uppy/audio,@uppy/dashboard,@uppy/drop-target,@uppy/webcam: add missing exports (Antoine du Hamel / #5014)
- @uppy/webcam: refactor to TypeScript (Antoine du Hamel / #4870)
## 3.2.1

@@ -4,0 +12,0 @@

4

lib/CameraIcon.js
import { h } from 'preact';
export default (() => {
export default function CameraIcon() {
return h("svg", {

@@ -14,2 +14,2 @@ "aria-hidden": "true",

}));
});
}
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
/* eslint-disable jsx-a11y/media-has-caption */
import { h, Component } from 'preact';

@@ -29,2 +30,3 @@ import SnapshotButton from "./SnapshotButton.js";

src,
// @ts-expect-error TODO: remove unused
recordedVideo,

@@ -52,3 +54,3 @@ recording,

const videoProps = {
playsinline: true
playsInline: true
};

@@ -62,7 +64,8 @@ if (recordedVideo) {

if (this.videoElement) {
this.videoElement.srcObject = undefined;
this.videoElement.srcObject = null;
}
} else {
videoProps.muted = true;
videoProps.autoplay = true;
videoProps.autoPlay = true;
// @ts-expect-error srcObject does not exist on <video> props
videoProps.srcObject = src;

@@ -69,0 +72,0 @@ }

/**
* Takes an Integer value of seconds (e.g. 83) and converts it into a human-readable formatted string (e.g. '1:23').
*
* @param {Integer} seconds
* @returns {string} the formatted seconds (e.g. '1:23' for 1 minute and 23 seconds)
*
*/
export default function formatSeconds(seconds) {
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, 0)}`;
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, '0')}`;
}
import { h } from 'preact';
export default (_ref => {
export default function PermissionsScreen(_ref) {
let {

@@ -15,2 +15,2 @@ icon,

}, hasCamera ? i18n('allowAccessTitle') : i18n('noCameraTitle')), h("p", null, hasCamera ? i18n('allowAccessDescription') : i18n('noCameraDescription')));
});
}
import { h } from 'preact';
import formatSeconds from './formatSeconds.js';
import formatSeconds from "./formatSeconds.js";
export default function RecordingLength(_ref) {

@@ -4,0 +4,0 @@ let {

import { h } from 'preact';
import CameraIcon from "./CameraIcon.js";
export default (_ref => {
export default function SnapshotButton(_ref) {
let {

@@ -16,2 +16,2 @@ onSnapshot,

}, CameraIcon());
});
}
import { h } from 'preact';
export default (_ref => {
export default function VideoSourceSelect(_ref) {
let {

@@ -20,2 +20,2 @@ currentDeviceId,

}, videoSource.label))));
});
}

@@ -11,10 +11,12 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import canvasToBlob from '@uppy/utils/lib/canvasToBlob';
import supportsMediaRecorder from './supportsMediaRecorder.js';
import supportsMediaRecorder from "./supportsMediaRecorder.js";
import CameraIcon from "./CameraIcon.js";
import CameraScreen from "./CameraScreen.js";
import PermissionsScreen from "./PermissionsScreen.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore We don't want TS to generate types for the package.json
const packageJson = {
"version": "3.3.6"
"version": "3.4.0"
};
import locale from './locale.js';
import locale from "./locale.js";

@@ -24,4 +26,4 @@ /**

*
* @param {string} fileType - MIME type or a file extension prefixed with `.`.
* @returns {string|undefined} The MIME type or `undefined` if the fileType is an extension and is not known.
* @param fileType - MIME type or a file extension prefixed with `.`.
* @returns The MIME type or `undefined` if the fileType is an extension and is not known.
*/

@@ -37,5 +39,2 @@ function toMimeType(fileType) {

* Is this MIME type a video?
*
* @param {string} mimeType - MIME type.
* @returns {boolean}
*/

@@ -48,5 +47,2 @@ function isVideoMimeType(mimeType) {

* Is this MIME type an image?
*
* @param {string} mimeType - MIME type.
* @returns {boolean}
*/

@@ -64,2 +60,18 @@ function isImageMimeType(mimeType) {

}
// set default options
const defaultOptions = {
onBeforeSnapshot: () => Promise.resolve(),
countdown: false,
modes: ['video-audio', 'video-only', 'audio-only', 'picture'],
mirror: true,
showVideoSourceDropdown: false,
facingMode: 'user',
// @TODO: remove in the next major
preferredImageMimeType: null,
preferredVideoMimeType: null,
showRecordingLength: false,
mobileNativeCamera: isMobile({
tablet: true
})
};

@@ -72,3 +84,6 @@ /**

constructor(uppy, opts) {
super(uppy, opts);
super(uppy, {
...defaultOptions,
...opts
});
// enableMirror is used to toggle mirroring, for instance when discarding the video,

@@ -99,24 +114,2 @@ // while `opts.mirror` is used to remember the initial user setting

this.defaultLocale = locale;
// set default options
const defaultOptions = {
onBeforeSnapshot: () => Promise.resolve(),
countdown: false,
modes: ['video-audio', 'video-only', 'audio-only', 'picture'],
mirror: true,
showVideoSourceDropdown: false,
facingMode: 'user',
// @TODO: remove in the next major
videoConstraints: undefined,
preferredImageMimeType: null,
preferredVideoMimeType: null,
showRecordingLength: false,
mobileNativeCamera: isMobile({
tablet: true
})
};
this.opts = {
...defaultOptions,
...opts
};
this.i18nInit();

@@ -199,2 +192,3 @@ this.title = this.i18n('pluginNameCamera');

start(options) {
var _options;
if (options === void 0) {

@@ -210,3 +204,5 @@ options = null;

}
const constraints = this.getConstraints(options && options.deviceId ? options.deviceId : null);
const constraints = this.getConstraints((_options = options) == null ? void 0 : _options.deviceId);
// TODO: add a return and/or convert this to async/await
this.hasCameraCheck().then(hasCamera => {

@@ -247,6 +243,2 @@ this.setPluginState({

}
/**
* @returns {object}
*/
getMediaRecorderOptions() {

@@ -423,3 +415,3 @@ const options = {};

}
if (count > 0) {
if (count) {
this.uppy.info(`${count}...`, 'warning', 800);

@@ -426,0 +418,0 @@ count--;

{
"name": "@uppy/webcam",
"description": "Uppy plugin that takes photos or records videos using the device's camera.",
"version": "3.3.6",
"version": "3.4.0",
"license": "MIT",

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

"dependencies": {
"@uppy/utils": "^5.7.2",
"@uppy/utils": "^5.7.5",
"is-mobile": "^3.1.1",

@@ -39,4 +39,4 @@ "preact": "^10.5.13"

"peerDependencies": {
"@uppy/core": "^3.9.1"
"@uppy/core": "^3.10.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

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc