Electrodynamics for moving elastic solids and viscous fluids