В настоящее время я работаю над проектом, который включает в себя воспроизведение музыки из музыкальной библиотеки iphone внутри приложения. Я использую MPMediaPickerController, чтобы пользователь мог выбирать свою музыку и воспроизводить ее с помощью музыкального плеера iPod в iPhone.
Однако, я столкнулся с проблемой, когда пользователь вставляет свой динамик и удаляет его. Музыка внезапно перестанет играть без причины. После некоторого тестирования я узнал, что проигрыватель iPod приостанавливает воспроизведение, когда пользователь отключает наушник от устройства. Итак, есть ли способ программно определить, отключен ли наушник, чтобы я мог возобновить воспроизведение музыки? Или есть ли способ предотвратить переключение iPod-плеера, когда пользователь отключает наушник?