Set the max camera resolution before commencing video streaming
This commit is contained in:
Vendored
+8
-11
@@ -12,7 +12,6 @@ function marhunPhotoCapturerFactory(modal_selector) {
|
||||
captureMedia: function (mediastream) {
|
||||
|
||||
let videoTrack = mediastream.getVideoTracks()[0];
|
||||
let imageCapturer = new ImageCapture(videoTrack);
|
||||
|
||||
let modal = document.querySelector(modal_selector);
|
||||
let imageTag = modal.querySelector('.image-tag-overallmarhun');
|
||||
@@ -93,12 +92,15 @@ function marhunPhotoCapturerFactory(modal_selector) {
|
||||
|
||||
getCamera: function () {
|
||||
function getCameraList() {
|
||||
let getUserMedia = () => navigator.mediaDevices.getUserMedia({ video: true });
|
||||
let getUserMedia = () => navigator.mediaDevices.getUserMedia({ video: {width: 3256, height: 2440} });
|
||||
|
||||
let enumerateDevices = () => navigator.mediaDevices.enumerateDevices()
|
||||
.then(devices => devices.filter(x => x.kind === 'videoinput'));
|
||||
let enumerateDevices = () => navigator.mediaDevices.enumerateDevices()
|
||||
.then(devices => devices.filter(x => x.kind === 'videoinput'))
|
||||
.then(x => {console.log; return x;});
|
||||
getUserMedia();
|
||||
|
||||
|
||||
|
||||
return enumerateDevices();
|
||||
}
|
||||
|
||||
@@ -158,9 +160,8 @@ function marhunPhotoCapturerFactory(modal_selector) {
|
||||
function composeConstraint(camera) {
|
||||
|
||||
let constraints = {
|
||||
width: { min: 640, ideal: 1920 },
|
||||
height: { min: 360, ideal: 1080 },
|
||||
aspectRatio: { ideal: 1.7777777778 },
|
||||
width: { exact: 3200 },
|
||||
height: { exact: 1800 },
|
||||
};
|
||||
|
||||
if (camera.deviceId !== '') {
|
||||
@@ -203,11 +204,7 @@ function marhunPhotoCapturerFactory(modal_selector) {
|
||||
let videoTagData = modal.querySelector('.video-tag-overallmarhun.video-data');
|
||||
|
||||
videoTagPreview.srcObject = stream;
|
||||
videoTagPreview.play();
|
||||
|
||||
|
||||
videoTagData.srcObject = stream;
|
||||
videoTagData.play();
|
||||
}
|
||||
|
||||
this.getCamera()
|
||||
|
||||
Reference in New Issue
Block a user