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