headphones

Can't get a notification when connecting an external accessory to the 3.5 mm headphones jack

丶灬走出姿态 提交于 2019-11-29 22:55:19
问题 I've been trying to get this to work for a while now. I've done everything they say in the documentation and still got nothing. This is the code in my app delegate that registers for local notifications: - (void) registerForLocalNotifications { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_accessoryConnected:) name:EAAccessoryDidConnectNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_accessoryDisconnected:) name

How to detect something in headphone jack on a Mac?

淺唱寂寞╮ 提交于 2019-11-29 02:28:55
Is there a way to detect if something is plugged into the headphone jack of a Mac using c or objective-c ? Thanks Should you still want to dive in and mess with this deep magic I was able to construct something together form the code I found here: http://www.iphonedevsdk.com/forum/iphone-sdk-development/54013-hardware-volume-change-listener-callback.html You want to register a listen to the AudioProperties and catch any messages about 'kAudioSessionProperty_AudioRouteChange'. Using the 'reason' and the 'name' you can parse togather what happened. You can also read more about that here: http:/

Is there an event for when the headphones are unplugged?

爷,独闯天下 提交于 2019-11-28 23:21:20
During a test, a client noticed that video playback in the iPhone pauses when headphones are unplugged. He wanted similar functionality for audio playback, and maybe the ability to pop up a message. Does anyone know if there's an event of some kind I could hook into to make this possible? henklein See Responding to Route Changes from the Audio Session Programming Guide. -marc This changed with iOS 7, you just need to listen to the notification named AVAudioSessionRouteChangeNotification [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChanged:) name

Check whether headphones are plugged in

↘锁芯ラ 提交于 2019-11-28 20:27:12
I can't seem to find a way to know on android if the headphones are plugged in. I found various solutions but they always seem to return false. The only thing that seems to work properly is a BroadcastReceiver , but that's not what I need: I just need something like this if(headphones plugged in) { } Is there such a function? Does it require some special permissions? Naskov You can use this code for checking if the headset is plugged in AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE); audioManager.isWiredHeadsetOn(); (Don't worry about the deprecation, it's

Detecting if headphones are plugged into iPhone

怎甘沉沦 提交于 2019-11-27 19:54:57
Does anyone know if you can detect if headphones are plugged into the iPhone, and if they aren't - disable sound from your application. I think I could manage disabling sound, but the detection part I have yet to find anything on. Thanks http://developer.apple.com/iphone/library/samplecode/SpeakHere/Introduction/Intro.html In this project there is a code-snippet where it pauses recording if the headphones is unpluged. Maybe you can use it to achieve your result. Good luck! (edit) You will have to study the SpeakHereController.mm file. I found this code in the awakeFromNib method // we do not

Detect if headphones are plugged in or not via C#

只愿长相守 提交于 2019-11-27 19:52:36
There is no example how to detect if headphones are plugged in or not via C#. I assume should be some event for that... Does make sense to use WMI? ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\cimv2", "SELECT * FROM Win32_SoundDevice"); foreach (ManagementObject queryObj in searcher.Get()) { Console.WriteLine("-----------------------------------"); Console.WriteLine("Win32_SoundDevice instance"); Console.WriteLine("-----------------------------------"); Console.WriteLine("StatusInfo: {0}", queryObj["StatusInfo"]); } Would anyone be so pleased to provide it? Thank you

Detect if headphones are plugged in or not via C#

╄→гoц情女王★ 提交于 2019-11-27 04:24:29
问题 There is no example how to detect if headphones are plugged in or not via C#. I assume should be some event for that... Does make sense to use WMI? ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\cimv2", "SELECT * FROM Win32_SoundDevice"); foreach (ManagementObject queryObj in searcher.Get()) { Console.WriteLine("-----------------------------------"); Console.WriteLine("Win32_SoundDevice instance"); Console.WriteLine("-----------------------------------"); Console

Detect headphones in Windows [duplicate]

拈花ヽ惹草 提交于 2019-11-27 03:06:00
问题 This question already has answers here : Detecting when head phones are plugged in (5 answers) Closed 5 years ago . I'm trying to detect if the headphones are plugged in on Windows. I've already tried DirectSound and the NAudio library and have not had any success. Does anyone have any suggestions? NOTE: this question is a duplicate of this question, but the answer to that question didn't contain any code samples or tutorials. 回答1: So...I think I might found something REALY obscure.. Can any

Are headphones plugged in? iOS7

随声附和 提交于 2019-11-26 23:38:51
Developing an app for an iPhone with audio files that need to be listened too through headphones. How do I check if headphones aren't plugged in so I can tell the user to plug in headphones. I have the following code from another thread but the audioSessionGetProperty method is deprecated. Anyone know how to alter the following code to make this work OR have there own code/solution. Thanks. - (BOOL)isHeadsetPluggedIn { UInt32 routeSize = sizeof (CFStringRef); CFStringRef route; //Maybe changing it to something like the following would work for iOS7? //AVAudioSession* session = [AVAudioSession

Are headphones plugged in? iOS7

自古美人都是妖i 提交于 2019-11-26 08:45:27
问题 Developing an app for an iPhone with audio files that need to be listened too through headphones. How do I check if headphones aren\'t plugged in so I can tell the user to plug in headphones. I have the following code from another thread but the audioSessionGetProperty method is deprecated. Anyone know how to alter the following code to make this work OR have there own code/solution. Thanks. - (BOOL)isHeadsetPluggedIn { UInt32 routeSize = sizeof (CFStringRef); CFStringRef route; //Maybe