Detecting superconductivity in the high pressure hydrides and metallic hydrogen from optical properties