Baseline Widely available *
MediaDevices
ì¸í°íì´ì¤ë ì¹´ë©ë¼, ë§ì´í¬, ê³µì íë©´ ë± íì¬ ì°ê²°ë 미ëì´ ì
ë ¥ ì¥ì¹ë¡ì ì ê·¼ ë°©ë²ì ì ê³µíë ì¸í°íì´ì¤ì
ëë¤. ë¤ë¥´ê² ë§íìë©´, 미ëì´ ë°ì´í°ë¥¼ ì ê³µíë 모ë íëì¨ì´ë¡ ì ê·¼í ì ìë ë°©ë²ì
ëë¤.
ë¶ëª¨ ì¸í°íì´ì¤ì¸ EventTarget
ì ìì±ì ììí©ëë¤.
devicechange
ì¬ì©ì ì»´í¨í°ì 미ëì´ ì
ì¶ë ¥ ì¥ì¹ê° ì¶ê°ëê±°ë ì ê±°ëì ë ë°ìí©ëë¤. ondevicechange
ìì±ì¼ë¡ë ì¬ì©í ì ììµëë¤.
ë¶ëª¨ ì¸í°íì´ì¤ì¸ EventTarget
ì ë©ìë를 ììí©ëë¤.
enumerateDevices()
getSupportedConstraints()
MediaStreamTrack
ì¸í°íì´ì¤ê° ì§ìíë ì ì½ì ëíë´ë MediaTrackSupportedConstraints
í¸í ê°ì²´ë¥¼ ë°íí©ëë¤.
getDisplayMedia()
MediaStream
ì¼ë¡ 캡ì²í´ ê³µì ë ë
¹í ì©ëë¡ ì¬ì©í íë©´ í¹ì íë©´ì ì¼ë¶(ì°½)를 ì ííëë¡ ì¬ì©ììê² ìì²í©ëë¤. MediaStream
ì¼ë¡ ì´ííë Promise
를 ë°íí©ëë¤.
getUserMedia()
MediaStream
ì ë°íí©ëë¤.
"use strict";
// Put variables in global scope to make them available to the browser console.
var video = document.querySelector("video");
var constraints = (window.constraints = {
audio: false,
video: true,
});
var errorElement = document.querySelector("#errorMsg");
navigator.mediaDevices
.getUserMedia(constraints)
.then(function (stream) {
var videoTracks = stream.getVideoTracks();
console.log("Got stream with constraints:", constraints);
console.log("Using video device: " + videoTracks[0].label);
stream.onremovetrack = function () {
console.log("Stream ended");
};
window.stream = stream; // make variable available to browser console
video.srcObject = stream;
})
.catch(function (error) {
if (error.name === "ConstraintNotSatisfiedError") {
errorMsg(
"The resolution " +
constraints.video.width.exact +
"x" +
constraints.video.width.exact +
" px is not supported by your device.",
);
} else if (error.name === "PermissionDeniedError") {
errorMsg(
"Permissions have not been granted to use your camera and " +
"microphone, you need to allow the page access to your devices in " +
"order for the demo to work.",
);
}
errorMsg("getUserMedia error: " + error.name, error);
});
function errorMsg(msg, error) {
errorElement.innerHTML += "<p>" + msg + "</p>";
if (typeof error !== "undefined") {
console.error(error);
}
}
ëª
ì¸ ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
getDisplayMedia()
ë©ìë를 ì ìíë Screen Capture APIMediaDevices
ê°ì²´ì 참조를 ë°ííë Navigator.mediaDevices
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4