@uppy/webcam
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
# @uppy/webcam | ||
## 3.0.0-beta.2 | ||
Released: 2022-07-27 | ||
Included in: Uppy v3.0.0-beta.3 | ||
- @uppy/dashboard,@uppy/webcam: Add support for `mobileNativeCamera` option to Webcam and Dashboard (Artur Paikin / #3844) | ||
## 2.2.1 | ||
@@ -4,0 +11,0 @@ |
@@ -13,3 +13,3 @@ function _extends() { _extends = Object.assign || 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); } | ||
function isModeAvailable(modes, mode) { | ||
return modes.indexOf(mode) !== -1; | ||
return modes.includes(mode); | ||
} | ||
@@ -16,0 +16,0 @@ |
@@ -13,2 +13,3 @@ function _extends() { _extends = Object.assign || 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 mimeTypes from '@uppy/utils/lib/mimeTypes'; | ||
import isMobile from 'is-mobile'; | ||
import canvasToBlob from '@uppy/utils/lib/canvasToBlob'; | ||
@@ -20,3 +21,3 @@ import supportsMediaRecorder from './supportsMediaRecorder.js'; | ||
const packageJson = { | ||
"version": "3.0.0-beta.1" | ||
"version": "3.0.0-beta.2" | ||
}; | ||
@@ -66,2 +67,6 @@ import locale from './locale.js'; | ||
} | ||
function isModeAvailable(modes, mode) { | ||
return modes.includes(mode); | ||
} | ||
/** | ||
@@ -123,3 +128,6 @@ * Webcam | ||
preferredVideoMimeType: null, | ||
showRecordingLength: false | ||
showRecordingLength: false, | ||
mobileNativeCamera: isMobile({ | ||
tablet: true | ||
}) | ||
}; | ||
@@ -623,2 +631,15 @@ this.opts = { ...defaultOptions, | ||
install() { | ||
const { | ||
mobileNativeCamera, | ||
modes | ||
} = this.opts; | ||
if (mobileNativeCamera) { | ||
this.uppy.getPlugin('Dashboard').setOptions({ | ||
showNativeVideoCameraButton: isModeAvailable(modes, 'video-only') || isModeAvailable(modes, 'video-audio'), | ||
showNativePhotoCameraButton: isModeAvailable(modes, 'picture') | ||
}); | ||
return; | ||
} | ||
this.setPluginState({ | ||
@@ -625,0 +646,0 @@ cameraReady: false, |
{ | ||
"name": "@uppy/webcam", | ||
"description": "Uppy plugin that takes photos or records videos using the device's camera.", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"license": "MIT", | ||
@@ -31,2 +31,3 @@ "main": "lib/index.js", | ||
"@uppy/utils": "^5.0.0-beta", | ||
"is-mobile": "^3.1.1", | ||
"preact": "^10.5.13" | ||
@@ -38,5 +39,5 @@ }, | ||
"peerDependencies": { | ||
"@uppy/core": "^3.0.0-beta.1" | ||
"@uppy/core": "^3.0.0-beta.2" | ||
}, | ||
"stableVersion": "2.2.1" | ||
} |
@@ -11,3 +11,3 @@ /* eslint-disable jsx-a11y/media-has-caption */ | ||
function isModeAvailable (modes, mode) { | ||
return modes.indexOf(mode) !== -1 | ||
return modes.includes(mode) | ||
} | ||
@@ -14,0 +14,0 @@ |
@@ -6,2 +6,3 @@ import { h } from 'preact' | ||
import mimeTypes from '@uppy/utils/lib/mimeTypes' | ||
import isMobile from 'is-mobile' | ||
import canvasToBlob from '@uppy/utils/lib/canvasToBlob' | ||
@@ -54,2 +55,7 @@ import supportsMediaRecorder from './supportsMediaRecorder.js' | ||
} | ||
function isModeAvailable (modes, mode) { | ||
return modes.includes(mode) | ||
} | ||
/** | ||
@@ -101,2 +107,3 @@ * Webcam | ||
showRecordingLength: false, | ||
mobileNativeCamera: isMobile({ tablet: true }), | ||
} | ||
@@ -594,2 +601,12 @@ | ||
install () { | ||
const { mobileNativeCamera, modes } = this.opts | ||
if (mobileNativeCamera) { | ||
this.uppy.getPlugin('Dashboard').setOptions({ | ||
showNativeVideoCameraButton: isModeAvailable(modes, 'video-only') || isModeAvailable(modes, 'video-audio'), | ||
showNativePhotoCameraButton: isModeAvailable(modes, 'picture'), | ||
}) | ||
return | ||
} | ||
this.setPluginState({ | ||
@@ -596,0 +613,0 @@ cameraReady: false, |
@@ -24,2 +24,3 @@ import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core' | ||
preferredVideoMimeType?: string | ||
mobileNativeCamera?: boolean | ||
} | ||
@@ -26,0 +27,0 @@ |
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
147545
2130
4
+ Addedis-mobile@^3.1.1
+ Addedis-mobile@3.1.1(transitive)