I'm looking to create an iphone app to help people monitor whether they are experiencing hearing loss from turning up the sound too high on their earbuds for a research project.
To do this, I want to periodically poll the volume level when music is playing on the iphone and the headphones are plugged in.
I did find the following answers that indicate it is possible however I am not familiar with iphone development.
checking when the audio is playing on the phone
Can my app be notified when another application starts/stops playing audio?
check if headphones are plugged in
Are headphones plugged in? iOS7
checking the volume level on the phone
https://stackoverflow.com/a/29170927/1361960
In Apple-way you cannot make app be notified when another application starts/stops playing audio.
Since the background execution of your app was limited according to the document.
Your code will only be executed when your application was running.
Related
I am working on autoplay with Google Chrome Cast, When the app in background state or device is locked / idle, the app playing one video next video is not playing, how to enable autoplay when the app in background mode or device locked.
When the device is locked GCKSession going into suspended state. How to overcome the issue.
Firstly you have to check all the basic functionality of chromcast, why chromecast stopped working.
1.WiFi Network
2.WiFi Connectivity
3.WiFi Frequency
4.Factory Reset
5.Reset your Router
6.Update Router’s Firmware
You can check all the checklist which are mention above.
Thank you.
Is there a method of determining the delay in audio when playing to bluetooth (or some other device, like airplay) on iOS?
I've searched and found a few things. The advanced audio distribution spec, for example, makes several references to "delay" reporting, but I'm not clear how to access this from iOS in the more general case of audio playback to some device.
If there were a method, iOS would use that method to play videos with the audio and video in sync which it doesn't seem to do. However, I do see some references to other systems being able to compensate for this (eg apparently the android YouTube player can compensate: Detect or Approximate Bluetooth Latency on Android (Audio Playback))
I came across this issue myself. AvAudioSession provides properties for outputLatency
as well as inputLatency. I do see differences in the values when I connect to a pair of bluetooth headphones, vs the iPhone microphone and speaker, though I cannot speak to how accurate these numbers are.
I have an audio app that plays for many hours throughout the night. Sometimes the iPhone changes routes and says the speaker is no longer available and stops playing audio. I'm not sure why but my theory is that it tried to connect to a Bluetooth device. I get the following in the log:
AVAudioSessionRouteChangeReasonCategoryChange
AVAudioSessionRouteChangeReasonOldDeviceUnavailable
And since the old device is no longer available it stops the audio. I'm playing audio through the iPhone speaker, so I'm not sure why the speaker would no longer be be available.
My question is what can I do to prevent this from happening in code? I advise people to turn on Airplane mode or disable Bluetooth which always fixes the issue. I'm wondering if something could be done in code to help solve this problem.
Is it possible to change the audio route when headphones are plug in or unplugged at iPhone's system level. Actually i want to listen the input and output audio only from internal iphone microphones whether headphones is connected or not.I have tried with kAudioSessionOverrideAudioRoute_Speaker , it is working fine at application level but not at system level. It is an enterprise applications. Any idea? please help me.
As per Audio session programming guide from Apple. You can only force play a audio file through iPhone speakers from app level by using setting kAudioSessionProperty_OverrideAudioRoute to kAudioSessionOverrideAudioRoute_Speaker. AFAIK system level it is not possible
I noticed it is possible for an iOS app to continue recording audio in the background while another app is in the foreground recording audio (note that this isn't strait forward on the iOS simulator, but a hack involving a background process makes it possible).
Is there any way to ensure that no other apps are recording audio before you start to record? If so, is there any way to stop other recording apps so that an app can record?
No, you cannot hinder another applications functions (well not using the iOS SDK) the only way this would be possible is on a jailbroken iPhone. But with an application built for the App Store this is not possible.
I think you may just tell user you can not get access, let them to turn off other background app.