cameraclick
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -0,1 +1,2 @@ | ||
console.log(`${require('../package.json').name}`, ' - v', require('../package.json').version); | ||
function CameraClick(element, camOptions) { | ||
@@ -28,17 +29,21 @@ let isPlaying = false; | ||
captureBtn.disabled = false; | ||
navigator.getUserMedia({ | ||
video: true | ||
}, function (localMediaStream) { | ||
videoWrapper.innerHTML = ''; | ||
videoWrapper.appendChild(videoCanvas); | ||
videoCanvas.srcObject = localMediaStream; | ||
mediaTracks = localMediaStream; | ||
window.mediaTracks = mediaTracks; | ||
if (typeof onSuccess === 'function') { | ||
onSuccess(localMediaStream); | ||
} | ||
}, function (error) { | ||
if (typeof onError === 'function') onError(error); | ||
}); | ||
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { | ||
navigator.mediaDevices.getUserMedia({ | ||
video: true | ||
}).then(function (localMediaStream) { | ||
videoWrapper.innerHTML = ''; | ||
videoWrapper.appendChild(videoCanvas); | ||
videoCanvas.srcObject = localMediaStream; | ||
mediaTracks = localMediaStream; | ||
window.mediaTracks = mediaTracks; | ||
if (typeof onSuccess === 'function') { | ||
console.log('rolou'); | ||
onSuccess(localMediaStream); | ||
} | ||
}).catch(function (error) { | ||
if (typeof onError === 'function') onError(error); | ||
}); | ||
} | ||
}; | ||
@@ -92,4 +97,2 @@ | ||
Array.from(this.getTracks()).forEach(function (track) { | ||
console.log('track: ', track); | ||
if (track) { | ||
@@ -96,0 +99,0 @@ track.stop(); |
{ | ||
"name": "cameraclick", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Simple script to capture images from your browser", | ||
@@ -5,0 +5,0 @@ "files": [ |
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
26105
231