How does the video tag of HTML5 handle the playing direction of the video?

  html5, question

Some of the videos recorded on the mobile phone are horizontal and some are vertical. I found that when using the video label to play, the horizontal video sometimes becomes vertical, even if the width and height are set. How is this playing direction determined

Let’s talk about a scene first.
Just open an article with video on WeChat, click on the video to play it, and turn your mobile phone into a horizontal screen.
The expected result is that the video is displayed horizontally and full-screen, but actually the current window is already horizontally displayed. I don’t know where the video is or whether it is playing in the small window inside.

The video tag itself does not have an event that responds to the horizontal and vertical screens.

Events and methods capable of capturing horizontal and vertical screen directions

  1. The window.orientation attribute and the onorientationchange event

  2. Resize monitoring is judged by calculation

  3. Css media query

/* vertical screen */
 @media screen and (orientation:portrait) {
 /* portrait-specific styles */
 /* horizontal screen */
 @media screen and (orientation:landscape) {
 /* landscape-specific styles */