Playing video and showing a "simple" webpage is not as easy as you think it is.
YouTube in particular is a pretty demanding webpage.
- it is highly dynamic, with several large sections of comments (which are expandable and contain sub menus and dynamically appearing "add comment" boxes)
- it has a large area of "suggested" videos, all of which equate to yet another image for the browser to load and show to you.
- it can have video of several different types in the main area and needs to be able to play hevc, h.264, webm and some others. All of these need some program within your browser to play as well as associated buffers to download and pass data to your graphics card. If your graphics card lacks hardware video decoding for the format selected then the browser must decode the video itself and use a lot more memory.
- the webpage does not fully unload when you navigate within the site, it has a lot of dynamic self management and navigation going on.
- all of the data you see has to be handled by the browser and processed in some way before handing over to your graphics card.
- the webpage is designed to be used on resolutions all the way from 1280*720 up to the newest 4k and 8k resolutions and will either load larger resolution elements or rely on raster images (which equates to yet another format to decode and be able to view - more code and buffers)
- YouTube also uses code to check your speed and might start with a lower quality stream and pre-buffer a high quality stream once it can see the connection speed is up to it or vice versa. This is yet more downloading and buffering of potentially larger amounts of data for the same amount of video.
All of this means libraries that do lots of work with lots of elements. All those elements take up RAM to track, to buffer their data and to handle.
In this way a modern browser is much more of a container or host for web-applications. The web is no longer "just" text and pictures and your browser is effectively a whole web "operating system" that handles all the display and running of web "programs".
Even Edge, Microsoft's vaunted "efficient" web browser, chews up upwards of 1GB of RAM to view just SuperUser and YouTube on machines I have used.
Because of all this work that a modern browser has to do just to show a webpage there has been a large amount of effort to make it faster and, while they were at it, more reliable and more secure.
Firefox Quantum is Mozilla's answer and it uses multiple processes to handle downloading, page processing, video handling and graphics card rendering. Chrome and other modern browsers all use similar methods. The downside is that there is some level of "bloat" in duplicated memory structures and necessary inter-process communication.
The media-rich web and resulting large browser requirements are why 4GB is no longer considered enough for the normal use and is only recommended for "light" use.