Does anyone know if it is technically possible for any of the supported players to detect the presence of headphones -- especially the ability to distinguish between headphones and speakers?

Perhaps if the impedance load of the connector attached to the headphone port could be determined, it might be possible to determine whether headphones or speakers have been plugged into the headphone port. I'm not sure what the impedance load range is for headphones versus (portable) speakers -- for this to be a viable detection method, I suppose there would need to be no overlap in impedance ranges for the two different types of devices in order to be able to distinguish between them.
Any other detection method ideas?