# Audio Management
# Audio Device Management
Audio device management mainly uses the methods in the JCMediaDevice class, as follows:
# Turn on/off the speaker
The UI turns on/off the speaker in the following ways:
/**
* @brief Turn on/off the speaker
* @param enable Turn on/off
*/
-(void)enableSpeaker:(bool)enable;
# Turn on/off audio devices
/**
* @brief Start audio (generally need to call this interface before officially starting a call)
* @return return true/ false
*/
-(bool)startAudio;
/**
* @brief Stop audio (usually be called at the end of the call)
* @return return true/ false
*/
-(bool)stopAudio;
# Get current audio mode
Only support earpieces and speakers currently:
/**
* @brief get the current audio mode (currently only supports the earpiece and speaker for iOS)
* @return audio mode
*/
-(NSString* __nullable)getAudioOutputType;
# Turn on/off the speaker
/**
* @brief whether the speaker is turned on (for iOS)
* @return ture/false
*/
-(bool)isSpeakerOn;
Sample code:
// Turn on/off the speaker
[mediaDevice enableSpeaker:true];
// Turn off the audio device
[mediaDevice stopAudio];
// Turn on the audio device
[mediaDevice startAudio]