This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
The resize event of the HTMLVideoElement interface fires when one or both of the videoWidth and videoHeight properties have just been updated.
This event is not cancelable but may bubble.
Use the event name in methods like addEventListener(), or set an event handler property.
addEventListener("resize", (event) => { })
onresize = (event) => { }
A generic Event.
<video id="media" src="https://example.com/video.mp4"></video>
const el = document.getElementById("media");
el.addEventListener("resize", () => {
console.log("The size of the video element has changed!");
});
| Specification |
|---|
| HTML> # event-media-resize> |
| HTML> # handler-onresize> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
resize_event |
3 | 7912–79Theonresize event handler property is not supported. |
3.5 | 10.5 | 3.1 | 18 | 4 | 11 | 3 | 1.0 | 4.4 | 3 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/resize_event