Media Capture and Streams API (Media Stream)

Media Streams API 혹은 MediaStream API라고도 불리는 Media Capture and Streams는 오디오와 비디오 데이터 스트리밍을 지원하는 WebRTC와 관련이 있는 API 입니다. 이 API는 미디어 스트림, 미디어 스트림의 트랙 구성원 (* 단일 오디오/비디오 데이터를 뜻 함) , 데이터 형식과 관련된 제한인자, 비동기적 데이터 사용과 관련된 성공/에러 호출, 그리고 이 과정에서 발생하는 이벤트들에 대한 인터페이스 및 메소드를 제공합니다.

Media Capture and Streams 기본 개념 및 사용법

이 API는 오디오 혹은 비디오와 관련된 데이터를 나타내는 MediaStream 객체를 다룹니다. 여기에 나온 예시를 확인해보십시오. 

MediaStream은 0개 혹은 여러개의 MediaStreamTrack객체로 이루어져있습니다. MediaStreamTrack객체는 여러 종류의 오디오 및 비디오 트랙 (tracks)을 나타냅니다. 각각의 MediaStreamTrack 는 하나 혹은 그 이상의 채널 (channels)을 가질 수 있습니다. 이 채널은 스테레오 오디오 트랙의 왼쪽/오른쪽과 같이 스피커에서 나오는 오디오 신호처럼 가장 작은 다위의 미디어 스트림을 뜻합니다.

MediaStream  객체는 하나의 입력인자결과 값을 가집니다. 객체는 

MediaStream objects have a single input and a single output. A MediaStream object getUserMedia()가 로컬로 호출되면 생성되고, 사용자의 카메라 혹은 마이크 중 하나를 입력 소스로 사용합니다. 비 로컬 MediaStream는 네트워크에서 발생하는 스트림인 <video> 혹은 <audio>와 같은 미디어 요소를 나타냅니다. 추가적으로 WebRTC RTCPeerConnection API에 의해 얻어지거나, Web Audio API MediaStreamAudioSourceNode을 사용해서 만들어진 스트림을 뜻합니다. MediaStream 객체의 결과 값은 컨슈머 (consumer)와 연결됩니다. <video> 혹은 <audio>와 같은 미디어 요소일 수도 있고, WebRTC RTCPeerConnection API 혹은, Web Audio API MediaStreamAudioSourceNode 일 수도 있습니다.

인터페이스

아래의 참조문서에서는 Media Capture and Streams API를 구성하는 각각의 인터페이스에 대해 알아야 할 기본적인 정보들을 제공합니다.

미디어스트림 API의 초기 버전에서는 MediaStreamTrack에 존재하는 AudioStreamTrackVideoStreamTrack 각각의 인터페이스를 따로 가졌습니다. 이 기능은 더 이상 사용되지 않으며, 오래된 방식으로 존재하던 코드들이 MediaStreamTrack을 바로 사용하도록 업데이트를 해야합니다.

이벤트

가이드 및 튜토리얼

아래의 문서에서 API는 이 API를 잘 사용 할 수 있도록 도와주고,원하는 업무를 어떻게 처리하는지에 대한 추가적인 가이드 및 정보를 제공합니다. 

There are no subpages at this time.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
MediaStreamChrome Full support 14Edge Full support YesFirefox Full support 15IE No support NoOpera Full support YesSafari Full support YesWebView Android Full support 37Chrome Android Full support 18Firefox Android Full support 15Opera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
MediaStream() constructorChrome Full support 19Edge Full support YesFirefox Full support 44IE No support NoOpera Full support 42Safari No support NoWebView Android Full support 37Chrome Android Full support 25Firefox Android Full support 42Opera Android No support NoSafari iOS No support NoSamsung Internet Android Full support 6.0
activeChrome Full support 45Edge Full support 12Firefox Full support 52IE No support NoOpera No support NoSafari Full support YesWebView Android Full support 45Chrome Android Full support 45Firefox Android Full support 52Opera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
active eventChrome Full support 45Edge ? Firefox ? IE No support NoOpera ? Safari ? WebView Android Full support 45Chrome Android Full support 45Firefox Android ? Opera Android No support NoSafari iOS ? Samsung Internet Android ?
addTrackChrome Full support 26Edge Full support 12Firefox Full support 44IE No support NoOpera No support NoSafari Full support YesWebView Android Full support 37Chrome Android Full support 26Firefox Android No support NoOpera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
addtrack eventChrome Full support YesEdge Full support 12Firefox Full support 50IE No support NoOpera No support NoSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 50Opera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
cloneChrome Full support 45Edge Full support 12Firefox Full support 48IE No support NoOpera No support NoSafari Full support YesWebView Android Full support 45Chrome Android Full support 45Firefox Android Full support 48Opera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
ended
Deprecated
Chrome No support ? — 54
Notes
No support ? — 54
Notes
Notes Deprecated in Chrome 52.
Edge ? Firefox No support NoIE No support NoOpera No support ? — 39Safari ? WebView Android No support ? — 54
Notes
No support ? — 54
Notes
Notes Deprecated in Chrome 52.
Chrome Android No support ? — 54
Notes
No support ? — 54
Notes
Notes Deprecated in Chrome 52.
Firefox Android No support NoOpera Android No support ? — 41Safari iOS ? Samsung Internet Android Full support Yes
getAudioTracksChrome Full support 26Edge Full support 12Firefox Full support 22
Notes
Full support 22
Notes
Notes Prior to Firefox 64, this method returned an array of AudioStreamTrack objects. However, MediaStreamTrack has now subsumed that interface's functionality.
IE No support NoOpera Full support YesSafari Full support YesWebView Android Full support 37Chrome Android Full support 26Firefox Android Full support 22
Notes
Full support 22
Notes
Notes Prior to Firefox 64, this method returned an array of AudioStreamTrack objects. However, MediaStreamTrack has now subsumed that interface's functionality.
Opera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
getTrackByIdChrome Full support 26Edge Full support 12Firefox Full support 49IE No support NoOpera No support NoSafari Full support YesWebView Android Full support 37Chrome Android Full support 26Firefox Android Full support 49Opera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
getTracks
Experimental
Chrome Full support 45Edge Full support 12Firefox Full support YesIE No support NoOpera Full support YesSafari Full support YesWebView Android Full support 45Chrome Android Full support 45Firefox Android Full support YesOpera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
getVideoTracks
Experimental
Chrome Full support 26Edge Full support 12Firefox Full support 22
Notes
Full support 22
Notes
Notes Prior to Firefox 64, this method returned an array of VideoStreamTrack objects. However, MediaStreamTrack has now subsumed that interface's functionality.
IE No support NoOpera Full support YesSafari Full support YesWebView Android Full support 37Chrome Android Full support 26Firefox Android Full support 22
Notes
Full support 22
Notes
Notes Prior to Firefox 64, this method returned an array of VideoStreamTrack objects. However, MediaStreamTrack has now subsumed that interface's functionality.
Opera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
idChrome No support ? — 54Edge Full support 12Firefox Full support 41IE No support NoOpera No support ? — 39Safari Full support YesWebView Android No support ? — 54Chrome Android No support ? — 54Firefox Android Full support 41Opera Android No support ? — 41Safari iOS Full support YesSamsung Internet Android Full support Yes
inactive eventChrome Full support 45Edge ? Firefox ? IE No support NoOpera ? Safari ? WebView Android Full support 45Chrome Android Full support 45Firefox Android ? Opera Android No support NoSafari iOS ? Samsung Internet Android ?
label
Deprecated
Chrome No support ? — 54
Notes
No support ? — 54
Notes
Notes Deprecated in Chrome 45.
Edge ? Firefox ? IE No support NoOpera No support NoSafari ? WebView Android No support ? — 54
Notes
No support ? — 54
Notes
Notes Deprecated in Chrome 45.
Chrome Android No support ? — 54
Notes
No support ? — 54
Notes
Notes Deprecated in Chrome 45.
Firefox Android ? Opera Android No support NoSafari iOS ? Samsung Internet Android Full support Yes
onactiveChrome Full support 45Edge ? Firefox ? IE No support NoOpera ? Safari ? WebView Android Full support 45Chrome Android Full support 45Firefox Android ? Opera Android No support NoSafari iOS ? Samsung Internet Android ?
onaddtrackChrome Full support 26Edge Full support 12Firefox Full support 50IE No support NoOpera No support NoSafari Full support YesWebView Android Full support 37Chrome Android Full support 26Firefox Android Full support 50Opera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
oninactiveChrome Full support 45Edge ? Firefox ? IE No support NoOpera ? Safari ? WebView Android Full support 45Chrome Android Full support 45Firefox Android ? Opera Android No support NoSafari iOS ? Samsung Internet Android ?
onremovetrackChrome Full support 26Edge Full support 12Firefox No support NoIE No support NoOpera No support NoSafari Full support YesWebView Android Full support 37Chrome Android Full support 26Firefox Android No support NoOpera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
removeTrackChrome Full support 26Edge Full support 12Firefox Full support YesIE No support NoOpera Full support YesSafari Full support YesWebView Android Full support 37Chrome Android Full support 26Firefox Android Full support YesOpera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
removetrack eventChrome Full support YesEdge Full support 12Firefox No support NoIE No support NoOpera No support NoSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android No support NoOpera Android No support NoSafari iOS Full support YesSamsung Internet Android Full support Yes
stop
Deprecated
Chrome No support ? — 47Edge Full support 13Firefox ? IE No support NoOpera No support NoSafari ? WebView Android No support ? — 47Chrome Android No support ? — 47Firefox Android ? Opera Android No support NoSafari iOS ? Samsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.

참조