0
我試圖調整getUserMedia攝像頭流的幀率顯示。我試圖使用的方法是在Moz開發人員網絡中引用的嘗試使用getUserMedia幀率約束
var constraints = { video: { frameRate: { ideal: 10, max: 15 } } };
。
我想創建幾個函數可以調用幀率更改爲不同的設置,但在試圖實現約束它似乎並沒有產生效果。我已經嘗試使用它單獨
function setFps1() {
var constraints ...
}
而且內功能,這(重新)宣佈流
function useVideo(){
// Query user for device permission
navigator.mediaDevices.getUserMedia({video: true})
// If granted
.then(function(stream) {
// Stream & play video from webcam
var video = document.getElementById('userVideo');
var constraints = { video: { frameRate: { ideal: 10, max: 15 } } };
video.src = window.URL.createObjectURL(stream);
video.play();
})
// If not
.catch(function(error) {
alert(error.message);
});
}
,並試圖
function useVideo(){
// Query user for device permission
navigator.mediaDevices.getUserMedia({video: true})
// If granted
.then(function(stream) {
// Stream & play video from webcam
var video = document.getElementById('userVideo');
video.src = window.URL.createObjectURL(stream);
video.play();
var constraints = { video: { frameRate: { ideal: 10, max: 15 } } };
})
// If not
.catch(function(error) {
alert(error.message);
});
}
的好辦法,想也許該視頻有在可以設置幀速率之前先播放。
如何意味着幀率限制使用,或者是什麼阻止我使用它嗎?