diff --git a/multimedia/audio_framework/common/native_audiostream_base.h b/multimedia/audio_framework/common/native_audiostream_base.h index c41efaf916b26aa4fc899812d02c3c8910649bb3..dacb5c92e9296b0de3142ed4abb71160dcbe6e34 100644 --- a/multimedia/audio_framework/common/native_audiostream_base.h +++ b/multimedia/audio_framework/common/native_audiostream_base.h @@ -275,6 +275,27 @@ typedef enum { AUDIOSTREAM_LATENCY_MODE_FAST = 1 } OH_AudioStream_LatencyMode; +/** + * @brief Define the audio stream volume mode. + * + * @since 16 + */ +typedef enum { + /** + * Indicates this audio stream volume will be affected by system volume, also the default behavior. + * + * @since 16 + */ + AUDIOSTREAM_VOLUMEMODE_SYSTEM_GLOBAL = 0, + /** + * Indicates this audio stream volume will be affected by app's individual volume percentage which set by yourself + * using the app volume api. + * + * @since 16 + */ + AUDIOSTREAM_VOLUMEMODE_APP_INDIVIDUAL = 1 +} OH_AudioStream_VolumeMode; + /** * @brief Define the audio event. * diff --git a/multimedia/audio_framework/common/native_audiostreambuilder.h b/multimedia/audio_framework/common/native_audiostreambuilder.h index de4451adfa7915fd37f208216aaa7c85105cdbbd..2db8222e0ddb5cb37da466ea941a41ad2938652c 100644 --- a/multimedia/audio_framework/common/native_audiostreambuilder.h +++ b/multimedia/audio_framework/common/native_audiostreambuilder.h @@ -177,6 +177,22 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetChannelLayout(OH_AudioStreamBuild OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererInfo(OH_AudioStreamBuilder* builder, OH_AudioStream_Usage usage); +/* + * Set the renderer volume mode of the stream client + * + * @since 16 + * + * @param builder Reference provided by OH_AudioStreamBuilder_Create() + * @param volumeMode Set the volume mode for the renderer client. + * @return Function result code: + * {@link AUDIOSTREAM_SUCCESS} If the execution is successful. + * {@link AUDIOSTREAM_ERROR_INVALID_PARAM}: + * 1.The param of builder is nullptr; + * 2.The param of volumeMode invalid. + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetVolumeMode(OH_AudioStreamBuilder* builder, + OH_AudioStream_VolumeMode volumeMode); + /* * Set the capturer information of the stream client * diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index 474b2885a2090ebfefdad3643fc87826bcc8f4c6..b61edfe000515d9965514adb1c80089ef1186c87 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -333,6 +333,18 @@ OH_AVErrCode OH_AVPlayer_GetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed * */ OH_AVErrCode OH_AVPlayer_SetAudioRendererInfo(OH_AVPlayer *player, OH_AudioStream_Usage streamUsage); +/** + * @brief Set the renderer volume mode of the player's audio renderer + * @param player Pointer to an OH_AVPlayer instance + * @param volumeMode The value {@link OH_AudioStream_VolumeMode} indicated volume mode of the player audio render. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input player is nullptr or volumeMode value is invalid. + * @since 16 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_SetVolumeMode(OH_AVPlayer *player, OH_AudioStream_VolumeMode volumeMode); + /** * @brief Set the interruption mode of the player's audio stream * @param player Pointer to an OH_AVPlayer instance