I'm running macOS High Sierra and have had a bizarre problem for months. When I use Safari to watch videos on YouTube, occasionally changing the time of the video (either with the arrow keys or with my mouse) causes the entire page to freeze, followed by the spinning beach ball. The audio will still play, but the video does not.
After this, all YouTube pages I have open in other tabs are responsive up until I try to resume their videos, at which point the page will freeze. If I try to get to youtube.com in a new tab, it won't load and I will just remain on my current webpage. Some other sites like google.com or anything with an HTML5 player will load content, but freeze the webpage immediately and cause high CPU usage.
At this point, iTunes and Quicktime will be responsive but not play music/videos, and won't reopen when closed. Opening Chrome and trying to get to youtube or google will yield the same result as in Safari. Interestingly, Google does work on Firefox and Youtube pages are accessible and responsive. However, the videos won't play and the "progress circle" on videos will spin forever, and it'll eventually notify me "If playback doesn't begin shortly try restarting your device"; meanwhile, Firefox will cause high CPU usage.
Sure enough, the only way to fix the problems is rebooting the whole system. This only seems to be caused by Safari and on YouTube. I would still like to use Safari, but it's inconvenient to have to reboot every time this happens. I've tried reinstalling macOS, resetting my NVRAM and clearing my cache, but to no avail.
Edit: This solution worked only temporarily. In my case, the problem is on-and-off and there is no way to know when it is going to happen.
This exact same thing was happening to me, but in Firefox. This answer from ElementaryOS-SE solved the issue for me. The solution is to basically install the plugin h264ify. From the GitHub page: