How to charge a battery when the charging socket is broken?
I had the same thing happen to a vaping device. What I did was cut a USB charging cable I had on hand and soldered the wires directly to the board where the charging port was in the vaping device. You'll have to tinker with it to determine where to solder the wires on the board of your speaker, though. Really, you only need the 5v and common wires of the USB cable and it should work fine. Red should be the 5V and black should be your common, but not all cables are the same. If you have a multimeter available, that'll help. You don't want to try to directly charge the battery unless you know what battery is in the device and have a lithium-ion battery charger that is adjustable (charge rate) and has overcharge protection.