headphones

How to detect unplugged headphone jack in WinRT?

本小妞迷上赌 提交于 2019-12-07 08:44:27
问题 Is there a way to get notified whenever a headphone jack is unplugged in a WinRT app? I want to be able to pause MediaElement playback when it happens to prevent the sound from leaking out through loudspeakers. 回答1: Jack detection notification is exposed through IMMNotificationClient::OnDeviceStateChanged. Just tried it on win8 desktop, OnDeviceStateChanged gets called with DEVICE_STATE_UNPLUGGED and DEVICE_STATE_ACTIVE when (un)plugging a device. Sadly that part of wasapi is documented as

How to detect unplugged headphone jack in WinRT?

£可爱£侵袭症+ 提交于 2019-12-05 16:21:49
Is there a way to get notified whenever a headphone jack is unplugged in a WinRT app? I want to be able to pause MediaElement playback when it happens to prevent the sound from leaking out through loudspeakers. Jack detection notification is exposed through IMMNotificationClient::OnDeviceStateChanged. Just tried it on win8 desktop, OnDeviceStateChanged gets called with DEVICE_STATE_UNPLUGGED and DEVICE_STATE_ACTIVE when (un)plugging a device. Sadly that part of wasapi is documented as desktop only so i guess there's no way to do it in WinRT. Try the following: Windows::Devices::Enumeration:

How to get notifications when the headphones are plugged in/out? Mac

做~自己de王妃 提交于 2019-12-04 07:54:29
问题 I'd like to get notified when headphones are plugged in or out in the headphone jack. I've searched around for this on stackoverflow but I can't seem to find what I'm looking for for the Mac, I can only find for iOS. So, do you have any ideas on how to perform this? What I want to do with this is: when headphones are plugged out I want to programmatically pause iTunes (iOS-like feature). Thank you! 回答1: You can observe changes using the CoreAudio framework. Both headphones and the speakers

iOS: Is it possible to send audio out both headphones and speakers at the same time?

不羁岁月 提交于 2019-12-04 05:12:52
We're looking to send some serial data out from the headphone jack, but would like to still be able to play audio from the speakers. Is it possible to send output to both? If so, is it possible to send different audio to each? Not as far as I'm aware. You can get programatic notification of when the routing has changed (i.e. when someone connects a headphone cable), but you are unable to specify which device(s) to use for output. 来源: https://stackoverflow.com/questions/10215923/ios-is-it-possible-to-send-audio-out-both-headphones-and-speakers-at-the-same-t

Sending Data through Headphone jack in Android phones

北慕城南 提交于 2019-12-02 17:18:50
I'm currently dealing with a new project and I have to send data through headphone jack with specific voltage, then i can work on that voltage. so here i need to program the specific voltage depends on my data. is it possible that i can access the output voltage of headphones in android and then create a application to control that voltage? davehale23 Here is a HackADay article dealing with this issue. http://hackaday.com/2010/02/01/android-audio-serial-connection/ It offers working code which was quite a bit simpler than I thought it would be. Although, like others have suggested, including

How to detect whether a headphone is inserted or removed in JavaScript?

喜欢而已 提交于 2019-11-30 16:25:24
Is there any event in JavaScript, I can listen to in browser, through which we can know whether headphones are inserted or removed? I assume if we are able to iterate over devices of audio output in JavaScript, is there a possibility, we can deduct the change in the number of audio output devices? You can use the following: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices example: navigator.mediaDevices.addEventListener('devicechange', () => { // Do whatever you need to with the devices // Maybe use enumerateDevices() to see what connected }); You could check the devices already

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

試著忘記壹切 提交于 2019-11-30 16:06:41
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:EAAccessoryDidDisconnectNotification object:nil]; [[EAAccessoryManager sharedAccessoryManager]

How to detect whether a headphone is inserted or removed in JavaScript?

时间秒杀一切 提交于 2019-11-30 15:57:11
问题 Is there any event in JavaScript, I can listen to in browser, through which we can know whether headphones are inserted or removed? I assume if we are able to iterate over devices of audio output in JavaScript, is there a possibility, we can deduct the change in the number of audio output devices? 回答1: You can use the following: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices example: navigator.mediaDevices.addEventListener('devicechange', () => { // Do whatever you need to with

Remote Control event in iOS with Swift

元气小坏坏 提交于 2019-11-30 09:48:05
Trying to figure out how to read the Apple headphone's volume buttons to use as a trigger for the camera shutter (as the Apple Camera app does). From the documentation on Remote Control Events , Remote Control Received With Event , and this git repo , I've pieced together that I'll probably need an AVAudioPlayer object, .beginReceivingRemoteControlEvents() , and remoteControlReceivedWithEvent , along with making this view canBecomeFirstResponder() return true . import UIKit import AVFoundation class ViewController: UIViewController, AVAudioPlayerDelegate { var player: AVAudioPlayer! override

headphone plug-in plug-out event when audio route doesn't change - iOS

一个人想着一个人 提交于 2019-11-30 09:43:06
问题 I'm working on iPad. I would like to detect when user plug-out headphone. First I used a listener on the property kAudioSessionProperty_AudioRouteChange . So all was working well until I've decided to add a button to switch to speakers when headphone was still plugged. So I’m now facing a problem, maybe someone would have an idea to fix it. Here is the scenario : I plug a headphone -> my audio route change callback is called then I switch sound to speakers (without unplugging my headphone) ->