Enabling or Muting the Audio Engine
Application Scenario
Enable or mute the audio engine.
Prerequisites
- The instruction stream engine has been started.
- The audio engine has been registered.
Development Process
- When the activity is started, call startAudio to enable the audio.
- When the activity is stopped, call stopAudio to mute the audio.
Encoding Instance
public class Activity implements NativeListener {
public void onStart() {
int ret = AudioTrackPlayer.startAudio();
if (ret == AudioTrackPlayer.VMI_SUCCESS) {
// The audio is successfully enabled.
}
if (ret == AudioTrackPlayer.VMI_AUDIO_ENGINE_CLIENT_START_FAIL) {
// The audio fails to be enabled.
}
}
public void onStop() {
int ret = AudioTrackPlayer.stopAudio();
if (ret == AudioTrackPlayer.VMI_SUCCESS) {
// The audio is successfully muted.
}
if (ret == AudioTrackPlayer.VMI_AUDIO_ENGINE_CLIENT_STOP_FAIL) {
// The audio fails to be muted.
}
}
}
Parent topic: API Development Process