-
Notifications
You must be signed in to change notification settings - Fork 0
/
changeVideoSize.js
30 lines (28 loc) · 1019 Bytes
/
changeVideoSize.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const supportedContraints = navigator.mediaDevices.getSupportedConstraints();
console.log(supportedContraints);
const changeVideoSize = () => {
stream.getVideoTracks().forEach((track) => {
// track is a video track
// we can get its capablities from ".getCapabilities()"
// or we can apply constraints with ".applyConstraints()"
const capabilities = track.getCapabilities();
const height = document.querySelector("#vid-height").value;
const width = document.querySelector("#vid-width").value;
const vConstraints = {
height: {
exact:
height < capabilities.height.max ? height : capabilities.height.max,
},
width: {
exact: width < capabilities.width.max ? width : capabilities.width.max,
},
// frameRate: 5,
// aspectRatio: 10,
};
track.applyConstraints(vConstraints);
});
// stream.getTracks().forEach((track) => {
// const capabilities = track.getCapabilities();
// console.log(capabilities);
// });
};