active

The active read-only property of the MediaStream interface returns a Boolean value that will return to be  true if the MediaStream is active, else false.

Syntax

JavaScript
var isActive = MediaStream.active;

Value

A Boolean value that returns true if the MediaStream is active, or false otherwise.

Example

JavaScript
var promise = navigator.mediaDevices.getUserMedia({ 
  audio: true, 
  video: true 
});

promise.then(function(stream) {
  var startBtn = document.querySelector('#startBtn');
  startBtn.disabled = stream.active; 
};)

Specifications

Specification Status Comment
Media Capture and Streams
The definition of 'active' in that specification.
Editor's Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) ? ? ? ?
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support (Yes) ? ? ? ? ? (Yes)

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/mediastream/active

API Media Streams API MediaStream Property Reference