Detecting video resolution changes
<p>With some codecs and containers, it's possible for a video to change resolution mid-stream.  This is particularly common with RTC-style video streams where resolution can scale up/down based on available bandwidth.  In other cases, the recording device might be rotated and the video may flip from portrait to landscape or vice versa.</p>

<p>When playing these videos on a web page (simple <code>&lt;video&gt;</code> tag), how can I detect when this change in size occurs with JavaScript?</p>

<p>The best I can think of is verifying the size of the video every frame, but there is quite a bit of overhead to this method.  If there were a way to have a callback fired when the video changed sizes, or an event triggered, that'd be best.</p>

<p>Example video that resizes, severely:  <a href="https://bugzilla.mozilla.org/attachment.cgi?id=8722238">https://bugzilla.mozilla.org/attachment.cgi?id=8722238</a></p>