Apple - Safari videos always go full-screen by themselves
STOP YOUTUBE, ETC. VIDEOS FROM OPENING FULL SCREEN
Note:
If you don’t see DEBUG as an option on the Safari menu at the top of the screen, first enable it as indicated in the next set of instructions below ("HOW TO HIDE OR UNHIDE DEBUG ON THE SAFARI MENU"), then return to these instructions to complete the process.
If DEBUG already appears as an option on the Safari menu, simply do as follows:
In Safari, click the DEBUG option at the top of the screen in the Safari menu.
Click MEDIA FLAGS.
Uncheck DISALLOW INLINE VIDEO.
Now the videos should play as normal without opening full screen in the future.
HOW TO HIDE OR UNHIDE DEBUG ON THE SAFARI MENU
To Enable Safari's Debug Menu:
Launch Terminal, by clicking Finder (on the Dock), then clicking APPLICATIONS, then clicking UTILITIES, then clicking TERMINAL.
Enter the following command line into Terminal by copying it and pasting it (triple click on it to select the entire line):
defaults write com.apple.Safari IncludeInternalDebugMenu 1
Press the RETURN key.
Launch (or close then relaunch) Safari, and you will notice the new Debug option appears in the Safari menu at the top of the screen.
To Re-Hide Safari’s Debug Menu:
If for any reason you ever want to re-hide DEBUG on the Safari menu, follow the same procedure but with the following command for Terminal instead.
Launch Terminal, by clicking Finder (on the Dock), then clicking APPLICATIONS, then clicking UTILITIES, then clicking TERMINAL.
Enter the following command line into Terminal by copying it and pasting it (triple-click on it to select the entire line):
defaults write com.apple.Safari IncludeInternalDebugMenu 0
Press the RETURN key.
Launch (or close then relaunch) Safari, and you will notice the Debug option has disappeared from the Safari menu at the top of the screen.
Turns out this was not a bug, it was a feature I had actually enabled myself.
Thanks to Bob's answer, I realized it was a setting - it's hidden in the Debug menu → Media Flags and called, appropriately enough, "Disallow inline video". One day I tested it out because I thought it would only disable unwanted ad videos, and the next day I of course forgot that I had enabled it. So if anyone finds this and has the same problem, check that setting.