diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index 1261bdd3b10c18efbed98887ede2416eefb081f2..9f89bc00c2a1c289b6de02345426530335a13b5d 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -621,6 +621,29 @@ OH_AVErrCode OH_AVPlayer_SetOnErrorCallback(OH_AVPlayer *player, OH_AVPlayerOnEr */ OH_AVErrCode OH_AVPlayer_SetVolumeMode(OH_AVPlayer *player, OH_AudioStream_VolumeMode volumeMode); +/** + * @brief Sets the loudness gain of current media. The default gain is 0.0 dB. + * This API can be called only when the AVPlayer is in the prepared, playing, paused completed or stopped state. + * The default loudness gain is 0.0dB. The stream usage of the player must be + * {@link OH_AudioStream_Usage#AUDIOSTREAM_USAGE_MUSIC}, {@link OH_AudioStream_Usage#AUDIOSTREAM_USAGE_MOVIE} + * or {@link OH_AudioStream_Usage#AUDIOSTREAM_USAGE_AUDIOBOOK}. + * The latency mode of the audio renderer must be {@link OH_AudioStream_LatencyMode#AUDIOSTREAM_LATENCY_MODE_NORMAL}. + * If AudioRenderer is played through the high-resolution pipe, this operation is not supported. + * + * @param player Pointer to an OH_AVPlayer instance. + * @param loudnessGain Loudness gain to set which changes from -90.0 to 24.0, expressing in dB. + * @return Function result code: + * {@link AV_ERR_OK} If the execution is successful. + * {@link AV_ERR_INVALID_VAL}:The value of player is a null pointer or + * the value of loudnessGain is invalid. + * {@link AV_ERR_INVALID_STATE}: The function is called in an incorrect state. or the stream usage of + * audioRendererInfo is not one of {@link StreamUsage#STREAM_USAGE_MUSIC}, + * {@link StreamUsage#STREAM_USAGE_MOVIE} or {@link StreamUsage#STREAM_USAGE_AUDIOBOOK}. + * {@link AV_ERR_SERVICE_DIED}: System errors such as media service breakdown. + * @since 21 + */ +OH_AVErrCode OH_AVPlayer_SetLoudnessGain(OH_AVPlayer *player, float loudnessGain); + #ifdef __cplusplus } #endif diff --git a/multimedia/player_framework/avplayer/libavplayer.ndk.json b/multimedia/player_framework/avplayer/libavplayer.ndk.json index 7f6d8b5bb7e8c1661a0550e673f96fb15a090a46..787c34354f8639f2322af6d64f98f0da6d114d96 100644 --- a/multimedia/player_framework/avplayer/libavplayer.ndk.json +++ b/multimedia/player_framework/avplayer/libavplayer.ndk.json @@ -146,5 +146,9 @@ { "first_introduced": "20", "name": "OH_AVPlayer_SetPlaybackRate" + }, + { + "first_introduced": "21", + "name": "OH_AVPlayer_SetLoudnessGain" } ] \ No newline at end of file