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

MediaRecorder() конструктор MediaRecorder объекта который будет делать запись переданного MediaStream.


var mediaRecorder = new MediaRecorder(stream[, options]);


Это MediaStream источника из которого будет производиться запись. Это может быть источник, созданный navigator.mediaDevices.getUserMedia() или <audio>, <video> или <canvas> елемент.

options Необязательный

A dictionary object that can contain the following properties:

  • mimeType: The mime type you want to use as the recording container for the new MediaRecorder. Applications can check in advance if this mimeType is supported by the user agent by calling MediaRecorder.isTypeSupported().
  • audioBitsPerSecond: The chosen bitrate for the audio component of the media.
  • videoBitsPerSecond: The chosen bitrate for the video component of the media.
  • bitsPerSecond: The chosen bitrate for the audio and video components of the media. This can be specified instead of the above two properties. If this is specified along with one or the other of the above properties, this will be used for the one that isn't specified.

If bits per second values are not specified for video and/or audio, the default adopted for video is 2.5Mbps, while the audio default is adaptive, depending upon the sample rate and the number of channels.


This example shows how to create a media recorder for a specified stream, whose audio bit rate is set to 128Kbit/sec and whose video bit rate is set to 2.5 Mbit/sec. The recorded media data will be stored in an MP4 wrapper (so if you gather the chunks of media data and save them to disk, they will be in an MP4 file).


if (navigator.mediaDevices.getUserMedia) {
  var constraints = { audio: true, video: true };
  var chunks = [];

  var onSuccess = function(stream) {
    var options = {
      audioBitsPerSecond : 128000,
      videoBitsPerSecond : 2500000,
      mimeType : 'video/mp4'
    var mediaRecorder = new MediaRecorder(stream,options);
    m = mediaRecorder;



Specification Status Comment
MediaStream Recording Рабочий черновик Initial definition

Browser compatibility

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!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 47 25.0 (25.0) Нет Нет Нет
options object Нет 43.0 (43.0) Нет Нет Нет
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support Нет 47 25.0 (25.0) 1.3[1] Нет Нет Нет 47

[1] The initial Firefox OS implementation only supported audio recording.

See also