API de Captura de Transmissões de Multimédia (Media Streams)

This translation is incomplete. Please help translate this article from English

A API de Media Capture and Streams, muitas vezes chamada de Media Stream API ou Stream API, é uma API relacionada com WebRTC que suporta transmissões de dados de áudio ou vídeo, os métodos para trabalhar com eles, as restrições associadas com o tipo de dados, as devoluções de retorno de sucesso e erro quando utilizar os dados de forma assíncrona, e os eventos que foram ativados durante o processo.

Conceitos básicos

The API is based on the manipulation of a MediaStream object representing a flux of audio- or video-related data. See an example in Get the video.

A MediaStream consists of zero or more MediaStreamTrack objects, representing various audio or video tracks. Each MediaStreamTrack may have one or more channels. The channel represents the smallest unit of a media stream, such as an audio signal associated with a given speaker, like left or right in a stereo audio track.

MediaStream objects have a single input and a single output. A MediaStream object generated by getUserMedia() is called local, and has as its source input one of the user's cameras or microphones. A non-local MediaStream may be representing to a media element, like <video> or <audio>, a stream originating over the network, and obtained via the WebRTC RTCPeerConnection API, or a stream created using the Web Audio API MediaStreamAudioSourceNode.   The output of the MediaStream object is linked to a consumer. It can be a media elements, like <audio> or <video>,  the WebRTC RTCPeerConnection API or a Web Audio API MediaStreamAudioDestinationNode.


Guias e tutoriais

There are no subpages at this time.

Compatibilidade de navegador

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Funcionalidade Chrome Firefox (Gecko) Edge Internet Explorer Opera  Safari (WebKit)
Stream API  21webkit  Nightly 18moz  (Yes) ?  12 ? 
Funcionalidade Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
API de emissão No support  (Yes) ? ?  No support  No support 


Currently using WebRTC for accessing the camera is supported in Chrome, Opera and Firefox Nightly 18. Enabling WebRTC in Firefox Nightly requires you to set a flag in the configuration:

  • Type "about:config" in the address bar and say yes that you want to make changes
  • Find the "media.navigator.enabled" entry and set it to true

Consulte também