This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The getVideoTracks() property of the MediaStream interface returns a sequence of MediaStreamTrack objects representing the video tracks in this stream.


var mediaStreamTracks[] = mediaStream.getVideoTracks()



Return value

An array of MediaStreamTrack.



The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses getVideoTracks() to retrieve a track for passing to the ImageCapture() constructor. 

const input = document.querySelector('input[type="range"]');

var imageCapture;

navigator.mediaDevices.getUserMedia({video: true})
.then(mediaStream => {
  document.querySelector('video').srcObject = mediaStream;

  const track = mediaStream.getVideoTracks()[0];
  imageCapture = new ImageCapture(track);

  return imageCapture.getPhotoCapabilities();


Specification Status Comment
Media Capture and Streams
The definition of 'getVideoTracks()' in that specification.
Candidate Recommendation Initial definition.

Browser Compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes12 ? ? Yes ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes Yes ? ? ? Yes

Document Tags and Contributors

Contributors to this page: fscholz, jpmedley
Last updated by: fscholz,