I would like to know answer for the following questions.
1) What happens if I try to play audio using AVAudioSession, where iphone speaker is faulty/defective/not working?
2) Is there any way, programatically check whether the speaker is working properly or its defective/faulty?
I would like to achieve this programatically not manually!
Please help or suggest.
Nothing happens with
avaudiosession when speaker will faulty or defective. It will complete it's work in regular manner as it do if speaker is not faulty.
For example your speaker have fault that it unable to raise volume after some level or it becomes very slow for some reason then
avaudiosession plays like usaul but volume level of output will be slow.
And you can't check this kind of stuff like speaker is faulty or not because fault can be of any type so there is no api or method that can identify hardware fault. You can check availability!