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.
Editor's Draft Initial definition.

Browser Compatibility

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

Document Tags and Contributors

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