RTC Room Engine SDK to implement audio settings related features.RTC Room Engine SDK, you need to complete log in to the SDK and ensure that you are in a live room.openLocalMicrophone and closeLocalMicrophone.openLocalMicrophone to turn on the microphone, you need to input a parameter quality in types of TUIAudioQuality to set the audio encoding quality. TUIAudioQuality includes following types. You can select based on your business requirement:Enumerated Value Type | Meaning |
speech | Voice mode. Mono; Raw Bit Rate of audio: 18 kbps; suitable for scenarios mainly for voice calls. |
default | Default mode. Mono; Raw Bit Rate of audio: 50 kbps; the default audio quality of the SDK. It is the recommended choice unless otherwise needed. |
music | Music mode. Stereo + full-band; Raw Bit Rate of audio: 128 kbps; suitable for scenarios requiring high-quality music transmission, such as online karaoke, music live streaming. |
openLocalMicrophone and closeLocalMicrophone.openLocalMicrophone to turn on the microphone, you need to input a parameter quality in types of AudioQuality to set the audio encoding quality. AudioQuality includes following types. You can select based on your business requirement:Enumerated Value Type | Meaning |
SPEECH | Voice mode. Mono; Raw Bit Rate of audio: 18 kbps; suitable for scenarios mainly for voice calls. |
DEFAULT | Default mode. Mono; Raw Bit Rate of audio: 50 kbps; the default audio quality of the SDK. It is the recommended choice unless otherwise needed. |
MUSIC | Music mode. Stereo + full-band; Raw Bit Rate of audio: 128 kbps; suitable for scenarios requiring high-quality music transmission, such as online karaoke, music live streaming. |
import RTCRoomEnginelet roomEngine = TUIRoomEngine.sharedInstance()// Turn on the local microphoneroomEngine.openLocalMicrophone(.default) {// Successfully turn on the microphone} onError: { code, message in// Fail to turn on the microphone}// Turn off the local microphoneroomEngine.closeLocalMicrophone()
TUIRoomEngine roomEngine = TUIRoomEngine.sharedInstance();// Turn on the local microphoneroomEngine.openLocalMicrophone(TUIRoomDefine.AudioQuality.DEFAULT, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Successfully turn on the microphone}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Fail to turn on the microphone}});// Turn off the local microphoneroomEngine.closeLocalMicrophone();
TUIAudioQuality needs to be consistent with what was mentioned in the previous context. Below, taking the default mode as an example, call the updateAudioQuality API to update the encoding quality of local audio:import RTCRoomEnginelet audioQuality: TUIAudioQuality = .defaultTUIRoomEngine.sharedInstance().updateAudioQuality(audioQuality)
AudioQuality needs to be the same as mentioned above. Below, taking the default mode as an example, call the updateAudioQuality API to update the encoding quality of local audio:TUIRoomDefine.AudioQuality audioQuality = TUIRoomDefine.AudioQuality.DEFAULT;TUIRoomEngine.sharedInstance().updateAudioQuality(audioQuality);
import RTCRoomEnginelet roomEngine = TUIRoomEngine.sharedInstance()// Pause publishing local audio streamroomEngine.muteLocalAudio()// Resume publishing local audio streamroomEngine.unmuteLocalAudio() {// Resume publishing successful} onError: { code, message in// Resume publishing failed}
TUIRoomEngine roomEngine = TUIRoomEngine.sharedInstance();// Pause publishing local audio streamroomEngine.muteLocalAudio();// Resume publishing local audio streamroomEngine.unmuteLocalAudio(new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Resume publishing successful}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Restore publication failed}});
TUIRoomObserver.Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan