headphones

Detect headphones Android

本小妞迷上赌 提交于 2021-02-04 16:39:25
问题 I program in recent years to Android and I wonder something: How to detect the presence of headphones? There is a method: isWiredHeadsetOn() but it doesn't work. I've tried that but it doesn't work: AudioManager am = (AudioManager)getSystemService(AUDIO_SERVICE); Log.i("am.isWiredHeadsetOn()", am.isWiredHeadsetOn() + ""); if (am.isWiredHeadsetOn()) { //code } Thank you (and sorry if I made spelling mistakes, I am French) 回答1: @Phil answer at https://stackoverflow.com/a/19102661/4758255 is a

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

我怕爱的太早我们不能终老 提交于 2020-01-01 09:30:31
问题 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? 回答1: 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

How To Get Electric Power From Head Phone Jack?

风流意气都作罢 提交于 2020-01-01 02:49:27
问题 My quest is if anyone knows how to create an Android app that can send electric charge through the device's headphone jack, like in this video iPocket_LED. The video shows an app for iPhone that controls a LED plugged into the headphone jack. I want to know how to access the device to send an electric signal. Sorry about my English, is not my language, I hope some one understand me 回答1: Many consumer devices which accept an external microphone will provide "plug-in power". This is a small

Sending Data through Headphone jack in Android phones

核能气质少年 提交于 2019-12-31 08:38:31
问题 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? 回答1: 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

Check whether headphones are plugged in

放肆的年华 提交于 2019-12-29 03:53:48
问题 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? 回答1: You can use this code for checking if the headset is plugged in AudioManager audioManager = (AudioManager)getSystemService

Play sound in both speaker and headset wpf

大兔子大兔子 提交于 2019-12-25 02:46:25
问题 I have an wpf application and i am using the soundPlayer class to play sound (for eg ringtone). Currently the tone plays either on speakers or on the headset (if its plugged in). I would like the application to play the tone on speaker even when the headsets are plugged in. I know there are ways to do this in android, but couldn't find any in wpf. Any help is appreciated. Thanks ! Sharing sample code : public void detectDevices() { int waveOutDevices = WaveOut.DeviceCount; switch

Has anyone tried to play sounds through the speakers and headphones at the same time? Android + iOS

柔情痞子 提交于 2019-12-25 02:28:18
问题 I currently have an app that generates sounds on the fly, like pure tones and white noise, and I can hear that on the headphones. Is it possible to send the same signal to the internal speakers and the headphones at the same time? I would like to do this on iOS 7 and KitKat. Probably, Android L and iOS 8 in the future... On iOS I have seen that a new feature was introduced on iOS 6, multiroute, which let select the audio route. The thing is that when I connect the headphones I can not choose

How can I capture the AudioDestinationNode value when headphones are plugged in with Web Audio API?

Deadly 提交于 2019-12-23 02:21:22
问题 I've been looking for a solution that detects the difference between the default speakers and headphones on a computer. I understand that with Web Audio API, AudioDestinationNode represents the output device, where users hear audio. My question (to be specific) is whether or not it is possible to detect a change in the users' audio output device (wired/wireless headphones). If this is not possible, is there a way to use phonegap to do so, for computers as well as mobile devices? My goal is to

Detecting if headset are plugged into iOS device

二次信任 提交于 2019-12-18 18:13:09
问题 There is an interactive movie on ios device. when movie starts (tap), the guy at the start of video will ask you plug headset , if plugged, then video should automatically jump straight to the story(straight go to the video-story). what should i do? and how to write a code? 回答1: First you will have to register for AudioRoute Changes :- AudioSessionAddPropertyListener (kAudioSessionProperty_AudioRouteChange, audioRouteChangeListenerCallback, self); Here You can depict the reason for changing

Remote Control event in iOS with Swift

廉价感情. 提交于 2019-12-18 13:26:49
问题 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