QUOTE(TimelessNL @ Oct 15 2013, 06:07 AM)
Normally this is done by measuring the resistance of audio cable. Like when there is no Cable connected the resistance of the 3,5mm audio plug is infinite. But when there is a cable attached the speakers of the headphone will decrease the resistance.
So by knowing that you can design an circuit that recognizes resistance and then switch an relay so the audio goes tough the 3,5mm headphone jack instead of the build in speakers. This also featured in most LCD screens with build in speakers.
alright wil look into ths. Thanks a lot