MediaRecorder: stream property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{APIRef("MediaStream Recording")}}

The **stream** read-only property of the {{domxref("MediaRecorder")}} interface returns the stream that was passed into the {{domxref("MediaRecorder.MediaRecorder", "MediaRecorder()")}} constructor when the MediaRecorder was created.

Value

The {{domxref("MediaStream")}} passed into the MediaRecorder() constructor when the MediaRecorder was originally created.

Examples

js
if (navigator.getUserMedia) {
  console.log("getUserMedia supported.");
  navigator.getUserMedia(
    // constraints - only audio needed for this app
    {
      audio: true,
    },

    // Success callback
    (stream) => {
      const mediaRecorder = new MediaRecorder(stream);

      const myStream = mediaRecorder.stream;
      console.log(myStream);
    },
  );
}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • Using the MediaStream Recording API
  • Web Dictaphone: MediaRecorder +

getUserMedia + Web Audio API visualization demo, by Chris Mills (source on GitHub.)

  • simpl.info MediaStream Recording demo, by Sam Dutton.
  • {{domxref("Navigator.getUserMedia")}}