Skip to main content
Inspiring
January 16, 2017
Question

Event listener switch speaker - headset on android

  • January 16, 2017
  • 1 reply
  • 438 views

How can I track the moment of switching headphone to speakers in Android?

I want this moment to put music on pause in the app.

Thank you.

This topic has been closed for replies.

1 reply

deesharm
Adobe Employee
Adobe Employee
January 17, 2017

Hi Maxxtr,

The following code switches between modes:

SoundMixer.audioPlaybackMode = _useLoudspeaker ? AudioPlaybackMode.MEDIA : AudioPlaybackMode.VOICE;

Please read more about Sound Mixer class through below link:

SoundMixer - Adobe ActionScript® 3 (AS3 ) API Reference

Thanks,

Adobe AIR Team

maxxtrAuthor
Inspiring
January 17, 2017

Thank you deesharm.

I don't understand this code. How to track a moment of a mode switching?

The moment a user disables his headphones off the Android device.