Search code examples
javascriptgoogle-chromewebrtcbrowser-api

How to track the resolution/aspect ratio of a WebRTC VideoStream in Chrome?


My webapp displays a realtime video stream coming from a mobile device. I need to take action when the video orientation changes.

Preferably I would want to subscribe for an event, but I did not find any such event on the MediaStreamTrack interface.

The closest thing I could find was getSettings, which according to MDN is supported since Chrome 53: https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack

But my Chrome (v54) does not seem to know about this function.

I would appreciate any ideas, suggestions or even just background information on above mentioned feature.


Solution

  • videoElement.onsize should be triggered. I doubt MediaStreamTrack.getSettings will trigger for a remote track...