diff --git a/multimedia/audio_framework/common/native_audiostream_base.h b/multimedia/audio_framework/common/native_audiostream_base.h index 2d05872a04fa253c99987d40bf08beb608cfeac9..ff59b446d3d305045ffdd3fd4c6c7e3d7579c4e3 100644 --- a/multimedia/audio_framework/common/native_audiostream_base.h +++ b/multimedia/audio_framework/common/native_audiostream_base.h @@ -476,7 +476,19 @@ typedef enum { * * @since 10 */ - AUDIOSTREAM_INTERRUPT_HINT_UNDUCK = 5 + AUDIOSTREAM_INTERRUPT_HINT_UNDUCK = 5, + /** + * Mute the stream. + * + * @since 20 + */ + AUDIOSTREAM_INTERRUPT_HINT_MUTE = 6, + /** + * Unmute the stream. + * + * @since 20 + */ + AUDIOSTREAM_INTERRUPT_HINT_UNMUTE = 7 } OH_AudioInterrupt_Hint; /** diff --git a/multimedia/audio_framework/common/native_audiostreambuilder.h b/multimedia/audio_framework/common/native_audiostreambuilder.h index 4fd3502b0d62d231911f084e4d869c91b234d868..ab52198a58a5837b0b1ef5b84804fd31cd1f570e 100644 --- a/multimedia/audio_framework/common/native_audiostreambuilder.h +++ b/multimedia/audio_framework/common/native_audiostreambuilder.h @@ -503,6 +503,20 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerInterruptCallback(OH_Audi */ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerErrorCallback(OH_AudioStreamBuilder* builder, OH_AudioCapturer_OnErrorCallback callback, void* userData); + +/** + * @brief Set audio capturer configuration, if app want its recorder only to be muted instead of interrupted. + * + * @param builder reference provided by OH_AudioStreamBuilder_Create() + * @param muteWhenInterrupted use {@code true} if application want to be muted instead of interrupted. + * @return function result code: + * {@link AUDIOSTREAM_SUCCESS} if the execution is successful. + * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} the param of builder is nullptr. + * @since 20 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerWillMuteWhenInterrupted(OH_AudioStreamBuilder* builder, + bool muteWhenInterrupted); + #ifdef __cplusplus } #endif diff --git a/multimedia/audio_framework/ohaudio.ndk.json b/multimedia/audio_framework/ohaudio.ndk.json index 4454472053f0465bb09231ec77a1339dd4e4e366..c1d3119afaf6a0f333bfca02b2f4d86e1199728d 100644 --- a/multimedia/audio_framework/ohaudio.ndk.json +++ b/multimedia/audio_framework/ohaudio.ndk.json @@ -422,5 +422,9 @@ { "first_introduced": "20", "name": "OH_AudioStreamManager_IsAcousticEchoCancelerSupported" + }, + { + "first_introduced": "20", + "name": "OH_AudioStreamBuilder_SetCapturerWillMuteWhenInterrupted" } ] diff --git a/multimedia/player_framework/avrecorder.h b/multimedia/player_framework/avrecorder.h index b5fc9847df671ecb4b66cd2aab6cc1da7b5a74d3..7a83727ef9fb41c59b093cd46c85d9c77fb80fb9 100644 --- a/multimedia/player_framework/avrecorder.h +++ b/multimedia/player_framework/avrecorder.h @@ -231,6 +231,19 @@ OH_AVErrCode OH_AVRecorder_SetErrorCallback(OH_AVRecorder *recorder, OH_AVRecord */ OH_AVErrCode OH_AVRecorder_SetUriCallback(OH_AVRecorder *recorder, OH_AVRecorder_OnUri callback, void *userData); +/** + * @brief Set recorder configuration, if app want its recorder only to be muted instead of interrupted. + * + * @param recorder Pointer to an OH_AVRecorder instance + * @param muteWhenInterrupted use {@code true} if application want to be muted instead of interrupted. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr. + * {@link AV_ERR_INVALID_STATE} function called in invalid state, only available before prepare state. + * @since 20 + */ +OH_AVErrCode OH_AVRecorder_SetWillMuteWhenInterrupted(OH_AVRecorder *recorder, bool muteWhenInterrupted); + #ifdef __cplusplus } #endif diff --git a/multimedia/player_framework/avrecorder/libavrecorder.ndk.json b/multimedia/player_framework/avrecorder/libavrecorder.ndk.json index 29ca772eb3296ac465832e3328160b55d9e49c30..e0ff0014471bdd144d0ae34590108ad41d1534a1 100644 --- a/multimedia/player_framework/avrecorder/libavrecorder.ndk.json +++ b/multimedia/player_framework/avrecorder/libavrecorder.ndk.json @@ -58,5 +58,9 @@ { "first_introduced": "18", "name": "OH_AVRecorder_SetUriCallback" + }, + { + "first_introduced": "20", + "name": "OH_AVRecorder_SetWillMuteWhenInterrupted" } ] \ No newline at end of file