Please realize I'm not a professional compressor repairman.
Your description "comes on for a few second, makes a slight humming sound, then goes silent" leaves me guessing. When you say "comes on" does that mean it "makes the pumping sound of a compressor" or it "Clicks"? Allow my musings.
On a plugged in and turned on compressor the compressor's pressure switch turns on the pump motor when the pressure falls below it's set low pressure threshold (usually ~ 90 psi). The pumps pushes air into the pressure tank until the pressure reaches its high pressure threshold (usually ~ 120 psi). If the compressor is not plugged in or turned on you can hear a click when the pressure switch turns on.
Aside: Leaks, of any sort, make the pumping more frequent or longer. Bad leaks can make it pump continuous because the high pressure threshold is never reached. The leaks can be in the switch, at line connections or in the pump (valves or piston rings) itself.
I once had a low-volume ultra-quiet compressor that made little more noise than a hum when compressing. If yours is not an ultra-quiet (clicks on, hums, and quits) than I'd have to guess that the pump might be binding instead of pumping. If it is binding then the motor would over-heats and shuts off.
Some compressors are oil cooled. If an oil cooled compressor was extremely low on oil would it bind? I suspect so.
If you suspect binding I'd find a parts list for your model to work from and disassemble the pump to investigate. (see link below)
That's my best guess on limited information. Good luck.
Campbell Hausfeld Air Compressor Parts