Chosen Solution
My iPhone 5s randomly shut off yesterday while it was plugged in and I was watching a YouTube video on it. The phone doesn’t indicate that it’s charging, I tried the hard reset (holding the power button and home button), tried placing the phone into recovery mode, iTunes on my computer won’t recognize the phone…I don’t know what the problem could be. I took the phone apart and reset all the connectors and reset the battery and nothing works, nor is there any visual sign of damage.
It could be just a dead battery. If you were using it plugged in, was it because you find that battery life is too short or was it just a coincidence? Replacing the battery is pretty straightforward so you should try that first. If it doesn’t solve your problem, then you may have an issue with the charge circuit (cheap chargers can damage the circuit). Have you tried different cables and chargers to rule that out?