I'm writing this blog post in the hope that Google YouTube engineers and/or Apple Safari engineers will notice it. I don't know how to file a YouTube bug report, and I didn't file a WebKit bug report because it's not clear that this problem is a WebKit bug as opposed to just a YouTube bug. I've noticed a problem with YouTube videos in macOS Safari, namely that many videos restart after about 4 seconds of playback. In my testing, this problem is specific to macOS Safari and doesn't occur in iOS Safari or any other web browser on macOS. Here's an example video that reproduces the problem for me every time: https://www.youtube.com/watch?v=CXhha5C3pzo (Morris Day interview about Prince).
I've debugged the problem with the Safari web inspector and discovered that YouTube is observing a SourceBuffer error event, which causes YouTube to create a new video element. Beyond that, I don't have any insight. This problem occurs even with no Safari extensions enabled, so it's not my fault!