1e41f4b71Sopenharmony_ci# AVPlayer 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## Overview 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ciThe AVPlayer module provides APIs related to media playback. 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci**Since**: 11 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci## Summary 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci### Files 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci| Name| Description| 19e41f4b71Sopenharmony_ci| -------- | -------- | 20e41f4b71Sopenharmony_ci| [avplayer.h](avplayer_8h.md) | Declares the AVPlayer APIs. You can use the native AVPlayer APIs to play a media asset. | 21e41f4b71Sopenharmony_ci| [avplayer_base.h](avplayer__base_8h.md) | Declares the structs and enums of the AVPlayer. | 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci### Structs 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci| Name| Description| 27e41f4b71Sopenharmony_ci| -------- | -------- | 28e41f4b71Sopenharmony_ci| struct [AVPlayerCallback](_a_v_player_callback.md) | (Deprecated) Contains the set of the **OH_AVPlayerOnInfo** and **OH_AVPlayerOnInfo** callback function pointers. | 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci### Types 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci| Name| Description| 34e41f4b71Sopenharmony_ci| -------- | -------- | 35e41f4b71Sopenharmony_ci| typedef struct [MediaKeySession](#mediakeysession) [MediaKeySession](#mediakeysession) | Defines a struct for the media key session. | 36e41f4b71Sopenharmony_ci| typedef struct [DRM_MediaKeySystemInfo](#drm_mediakeysysteminfo) [DRM_MediaKeySystemInfo](#drm_mediakeysysteminfo) | Defines a struct for the media key system information. | 37e41f4b71Sopenharmony_ci| typedef void(\* [Player_MediaKeySystemInfoCallback](#player_mediakeysysteminfocallback)) (OH_AVPlayer \*player, [DRM_MediaKeySystemInfo](#drm_mediakeysysteminfo) \*mediaKeySystemInfo) | Defines the callback invoked when media key system information of the AVPlayer is updated. | 38e41f4b71Sopenharmony_ci| typedef enum [AVPlayerState](#avplayerstate-1) [AVPlayerState](#avplayerstate) | Defines an enum for the AVPlayer states. | 39e41f4b71Sopenharmony_ci| typedef enum [AVPlayerSeekMode](#avplayerseekmode-1) [AVPlayerSeekMode](#avplayerseekmode) | Defines an enum for the seek modes of the AVPlayer. | 40e41f4b71Sopenharmony_ci| typedef enum [AVPlaybackSpeed](#avplaybackspeed-1) [AVPlaybackSpeed](#avplaybackspeed) | Defines an enum for the playback speeds of the AVPlayer. | 41e41f4b71Sopenharmony_ci| typedef enum [AVPlayerOnInfoType](#avplayeroninfotype-1) [AVPlayerOnInfoType](#avplayeroninfotype) | Defines an enum for the types of messages received by the AVPlayer. | 42e41f4b71Sopenharmony_ci| typedef enum [AVPlayerBufferingType](#avplayerbufferingtype-1) [AVPlayerBufferingType](#avplayerbufferingtype) | Defines an enum for the types of buffer messages of the AVPlayer. | 43e41f4b71Sopenharmony_ci| typedef void(\*[OH_AVPlayerOnInfo](#oh_avplayeroninfo)) (OH_AVPlayer \*player, [AVPlayerOnInfoType](#avplayeroninfotype) type, int32_t extra) | (Deprecated) Defines the callback invoked when the AVPlayer receives a message. | 44e41f4b71Sopenharmony_ci| typedef void(\*[OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback)) (OH_AVPlayer \*player, [AVPlayerOnInfoType](#avplayeroninfotype) type, OH_AVFormat \*infoBody, void \*userData) | Defines the callback invoked when the AVPlayer receives a message. If this callback is successfully set, the **OH_AVPlayerOnInfo** function will not be invoked. | 45e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVPlayerOnError](#oh_avplayeronerror)) (OH_AVPlayer \*player, int32_t errorCode, const char \*errorMsg) | (Deprecated) Defines the callback invoked when an error occurs in the AVPlayer. This type is available in API version 9 or later. | 46e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVPlayerOnErrorCallback](#oh_avplayeronerrorcallback)) (OH_AVPlayer \*player, int32_t errorCode, const char \*errorMsg, void \*userData) | Defines the callback invoked when an error occurs in the AVPlayer. If this callback is successfully set, the **OH_AVPlayerOnError** function will not be invoked. | 47e41f4b71Sopenharmony_ci| typedef struct [AVPlayerCallback](_a_v_player_callback.md) [AVPlayerCallback](#avplayercallback) | (Deprecated) Contains the set of the **OH_AVPlayerOnInfo** and **OH_AVPlayerOnInfo** callback function pointers. | 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci 50e41f4b71Sopenharmony_ci### Enums 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_ci| Name| Description| 53e41f4b71Sopenharmony_ci| -------- | -------- | 54e41f4b71Sopenharmony_ci| [AVPlayerState](#avplayerstate-1) {<br>AV_IDLE = 0, <br>AV_INITIALIZED = 1, <br>AV_PREPARED = 2, <br>AV_PLAYING = 3,<br>AV_PAUSED = 4, <br>AV_STOPPED = 5, <br>AV_COMPLETED = 6, <br>AV_RELEASED = 7,<br>AV_ERROR = 8<br>} | Enumerates the AVPlayer states.| 55e41f4b71Sopenharmony_ci| [AVPlayerSeekMode](#avplayerseekmode) { <br>AV_SEEK_NEXT_SYNC = 0, <br>AV_SEEK_PREVIOUS_SYNC, <br>AV_SEEK_CLOSEST = 2<br>} | Enumerates the seek modes of the AVPlayer.| 56e41f4b71Sopenharmony_ci| [AVPlaybackSpeed](#avplaybackspeed-1) {<br>AV_SPEED_FORWARD_0_75_X, <br>AV_SPEED_FORWARD_1_00_X, <br>AV_SPEED_FORWARD_1_25_X, <br> AV_SPEED_FORWARD_1_75_X,<br>AV_SPEED_FORWARD_2_00_X, <br>AV_SPEED_FORWARD_0_50_X, <br>AV_SPEED_FORWARD_1_50_X<br>} | Enumerates the playback speeds of the AVPlayer. | 57e41f4b71Sopenharmony_ci| [AVPlayerOnInfoType](#avplayeroninfotype-1) {<br>AV_INFO_TYPE_SEEKDONE = 0, <br>AV_INFO_TYPE_SPEEDDONE = 1, <br>AV_INFO_TYPE_BITRATEDONE = 2, <br>AV_INFO_TYPE_EOS = 3,<br>AV_INFO_TYPE_STATE_CHANGE = 4, <br>AV_INFO_TYPE_POSITION_UPDATE = 5, <br>AV_INFO_TYPE_MESSAGE = 6, <br>AV_INFO_TYPE_VOLUME_CHANGE = 7,<br>AV_INFO_TYPE_RESOLUTION_CHANGE = 8, <br>AV_INFO_TYPE_BUFFERING_UPDATE = 9, <br>AV_INFO_TYPE_BITRATE_COLLECT = 10, <br>AV_INFO_TYPE_INTERRUPT_EVENT = 11,<br>AV_INFO_TYPE_DURATION_UPDATE = 12, <br>AV_INFO_TYPE_IS_LIVE_STREAM = 13, <br>AV_INFO_TYPE_TRACKCHANGE = 14, <br>AV_INFO_TYPE_TRACK_INFO_UPDATE = 15,<br>AV_INFO_TYPE_SUBTITLE_UPDATE = 16, AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE = 17<br>} | Enumerates the types of messages received by the AVPlayer.| 58e41f4b71Sopenharmony_ci| [AVPlayerBufferingType](#avplayerbufferingtype-1) { <br>AVPLAYER_BUFFERING_START = 1, <br>AVPLAYER_BUFFERING_END, <br>AVPLAYER_BUFFERING_PERCENT, <br>AVPLAYER_BUFFERING_CACHED_DURATION <br>} | Enumerates the types of buffer messages of the AVPlayer. | 59e41f4b71Sopenharmony_ci 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci### Functions 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci| Name| Description| 64e41f4b71Sopenharmony_ci| -------- | -------- | 65e41f4b71Sopenharmony_ci| OH_AVPlayer \*[OH_AVPlayer_Create](#oh_avplayer_create) (void) | Creates an **OH_AVPlayer** instance.| 66e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetURLSource](#oh_avplayer_seturlsource) (OH_AVPlayer \*player, const char \*url) | Sets the HTTP URL of a media source to be played by an AVPlayer. | 67e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetFDSource](#oh_avplayer_setfdsource) (OH_AVPlayer \*player, int32_t fd, int64_t offset, int64_t size) | Sets the file descriptor of a media source to be played by an AVPlayer.| 68e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Prepare](#oh_avplayer_prepare) (OH_AVPlayer \*player) | Prepares the playback environment and buffers media data.| 69e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Play](#oh_avplayer_play) (OH_AVPlayer \*player) | Starts playback.| 70e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Pause](#oh_avplayer_pause) (OH_AVPlayer \*player) | Pauses playback.| 71e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Stop](#oh_avplayer_stop) (OH_AVPlayer \*player) | Stops playback.| 72e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Reset](#oh_avplayer_reset) (OH_AVPlayer \*player) | Restores the AVPlayer to the initial state.| 73e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Release](#oh_avplayer_release) (OH_AVPlayer \*player) | Asynchronously releases an **OH_AVPlayer** instance.| 74e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_ReleaseSync](#oh_avplayer_releasesync) (OH_AVPlayer \*player) | Synchronously releases an **OH_AVPlayer** instance.| 75e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetVolume](#oh_avplayer_setvolume) (OH_AVPlayer \*player, float leftVolume, float rightVolume) | Sets the volume for an AVPlayer.| 76e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Seek](#oh_avplayer_seek) (OH_AVPlayer \*player, int32_t mSeconds, [AVPlayerSeekMode](#avplayerseekmode) mode) | Seeks to a playback position.| 77e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetCurrentTime](#oh_avplayer_getcurrenttime) (OH_AVPlayer \*player, int32_t \*currentTime) | Obtains the playback position, in milliseconds.| 78e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetVideoWidth](#oh_avplayer_getvideowidth) (OH_AVPlayer \*player, int32_t \*videoWidth) | Obtains the video width.| 79e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetVideoHeight](#oh_avplayer_getvideoheight) (OH_AVPlayer \*player, int32_t \*videoHeight) | Obtains the video height.| 80e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetPlaybackSpeed](#oh_avplayer_setplaybackspeed) (OH_AVPlayer \*player, [AVPlaybackSpeed](#avplaybackspeed) speed) | Sets the playback speed for an AVPlayer.| 81e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetPlaybackSpeed](#oh_avplayer_getplaybackspeed) (OH_AVPlayer \*player, [AVPlaybackSpeed](#avplaybackspeed) \*speed) | Obtains the playback speed of an AVPlayer.| 82e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetAudioRendererInfo](#oh_avplayer_setaudiorendererinfo) (OH_AVPlayer \*player, OH_AudioStream_Usage streamUsage) | Sets the audio stream type for an AVPlayer. | 83e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetAudioInterruptMode](#oh_avplayer_setaudiointerruptmode) (OH_AVPlayer \*player, OH_AudioInterrupt_Mode interruptMode) | Sets the audio interruption mode for an AVPlayer. | 84e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetAudioEffectMode](#oh_avplayer_setaudioeffectmode) (OH_AVPlayer \*player, OH_AudioStream_AudioEffectMode effectMode) | Sets the audio effect mode for an AVPlayer. | 85e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SelectBitRate](#oh_avplayer_selectbitrate) (OH_AVPlayer \*player, uint32_t bitRate) | Sets the bit rate used by an HLS player.| 86e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetVideoSurface](#oh_avplayer_setvideosurface) (OH_AVPlayer \*player, OHNativeWindow \*window) | Sets a playback window.| 87e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetDuration](#oh_avplayer_getduration) (OH_AVPlayer \*player, int32_t \*duration) | Obtains the total duration of a media file, in milliseconds.| 88e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetState](#oh_avplayer_getstate) (OH_AVPlayer \*player, [AVPlayerState](#avplayerstate) \*state) | Obtains the AVPlayer state.| 89e41f4b71Sopenharmony_ci| bool [OH_AVPlayer_IsPlaying](#oh_avplayer_isplaying) (OH_AVPlayer \*player) | Checks whether an AVPlayer is playing.| 90e41f4b71Sopenharmony_ci| bool [OH_AVPlayer_IsLooping](#oh_avplayer_islooping) (OH_AVPlayer \*player) | Checks whether an AVPlayer is looping.| 91e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetLooping](#oh_avplayer_setlooping) (OH_AVPlayer \*player, bool loop) | Enables loop playback.| 92e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetPlayerCallback](#oh_avplayer_setplayercallback) (OH_AVPlayer \*player, [AVPlayerCallback](_a_v_player_callback.md) callback) | Sets a callback for an AVPlayer.| 93e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SelectTrack](#oh_avplayer_selecttrack) (OH_AVPlayer \*player, int32_t index) | Selects an audio track. This function is not supported yet.| 94e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_DeselectTrack](#oh_avplayer_deselecttrack) (OH_AVPlayer \*player, int32_t index) | Deselects an audio track. This function is not supported yet.| 95e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetCurrentTrack](#oh_avplayer_getcurrenttrack) (OH_AVPlayer \*player, int32_t trackType, int32_t \*index) | Obtains the currently valid track. This function is not supported yet.| 96e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetMediaKeySystemInfoCallback](#oh_avplayer_setmediakeysysteminfocallback) (OH_AVPlayer \*player, Player_MediaKeySystemInfoCallback callback) | Sets a callback to return the media key system information for an AVPlayer.| 97e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetMediaKeySystemInfo](#oh_avplayer_getmediakeysysteminfo) (OH_AVPlayer \*player, [DRM_MediaKeySystemInfo](../apis-drm-kit/_d_r_m___media_key_system_info.md) \*mediaKeySystemInfo) | Obtains the media key system information to create a media key session.| 98e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetDecryptionConfig](#oh_avplayer_setdecryptionconfig) (OH_AVPlayer \*player, [MediaKeySession](../apis-drm-kit/_drm.md#mediakeysession) \*mediaKeySession, bool secureVideoPath) | Sets the decryption information.| 99e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetOnInfoCallback](#oh_avplayer_setoninfocallback) (OH_AVPlayer \*player, [OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback) callback, void \*userData) | Sets a callback for the event indicating that the AVPlayer receives a message. | 100e41f4b71Sopenharmony_ci| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetOnErrorCallback](#oh_avplayer_setonerrorcallback) (OH_AVPlayer \*player, [OH_AVPlayerOnErrorCallback](#oh_avplayeronerrorcallback) callback, void \*userData) | Sets a callback for the event indicating that an error occurs in the AVPlayer. | 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ci 103e41f4b71Sopenharmony_ci### Variables 104e41f4b71Sopenharmony_ci 105e41f4b71Sopenharmony_ci| Name| Description| 106e41f4b71Sopenharmony_ci| -------- | -------- | 107e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_STATE](#oh_player_state) | Pointer to the key for obtaining the AVPlayer state. The value is of the int32_t type. | 108e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_STATE_CHANGE_REASON](#oh_player_state_change_reason) | Pointer to the key for obtaining the AVPlayer state change reason. The value is of the int32_t type. | 109e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_VOLUME](#oh_player_volume) | Pointer to the key for obtaining the volume. The value type is float. | 110e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_BITRATE_ARRAY](#oh_player_bitrate_array) | Pointer to the key for obtaining the bit rate array. The value is of the uint8_t byte array type, which is expressed by [AV_INFO_TYPE_BITRATE_COLLECT](#avplayeroninfotype-1). | 111e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_AUDIO_INTERRUPT_TYPE](#oh_player_audio_interrupt_type) | Pointer to the key for obtaining the audio interruption type. The value is of the int32_t type. | 112e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_AUDIO_INTERRUPT_FORCE](#oh_player_audio_interrupt_force) | Pointer to the key for obtaining the FORCE type of audio interruption. The value is of the int32_t type. | 113e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_AUDIO_INTERRUPT_HINT](#oh_player_audio_interrupt_hint) | Pointer to the key for obtaining the HINT type of audio interruption. The value is of the int32_t type. | 114e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON](#oh_player_audio_device_change_reason) | Pointer to the key for obtaining the audio device change reason. The value is of the int32_t type. | 115e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_BUFFERING_TYPE](#oh_player_buffering_type) | Pointer to the key for obtaining the type of the buffer update message. The value type is [AVPlayerBufferingType](#avplayerbufferingtype-1). | 116e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_BUFFERING_VALUE](#oh_player_buffering_value) | Pointer to the key for obtaining the value of the buffer update message. The value is of the int32_t type. | 117e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_SEEK_POSITION](#oh_player_seek_position) | Pointer to the key for obtaining the playback progress after the seek operation. The value is of the int32_t type. | 118e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_PLAYBACK_SPEED](#oh_player_playback_speed) | Pointer to the key for obtaining the playback speed. The value type is [AVPlaybackSpeed](#avplaybackspeed-1). | 119e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_BITRATE](#oh_player_bitrate) | Pointer to the key for obtaining the bit rate. The value is of the int32_t type. | 120e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_CURRENT_POSITION](#oh_player_current_position) | Pointer to the key for obtaining the playback progress information. The value is of the int32_t type. | 121e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_DURATION](#oh_player_duration) | Pointer to the key for obtaining the media asset duration. The value type is int64_t. | 122e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_VIDEO_WIDTH](#oh_player_video_width) | Pointer to the key for obtaining the video width. The value is of the int32_t type. | 123e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_VIDEO_HEIGHT](#oh_player_video_height) | Pointer to the key for obtaining the video height. The value is of the int32_t type. | 124e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_MESSAGE_TYPE](#oh_player_message_type) | Pointer to the key for obtaining the type of message received by the AVPlayer. The value is of the int32_t type. | 125e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_IS_LIVE_STREAM](#oh_player_is_live_stream) | Pointer to the key for checking whether a media asset is live streaming. The value is of the int32_t type. | 126e41f4b71Sopenharmony_ci 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ci## Type Description 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ci 131e41f4b71Sopenharmony_ci### AVPlaybackSpeed 132e41f4b71Sopenharmony_ci 133e41f4b71Sopenharmony_ci``` 134e41f4b71Sopenharmony_citypedef enum AVPlaybackSpeed AVPlaybackSpeed 135e41f4b71Sopenharmony_ci``` 136e41f4b71Sopenharmony_ci 137e41f4b71Sopenharmony_ci**Description** 138e41f4b71Sopenharmony_ci 139e41f4b71Sopenharmony_ciDefines an enum for the playback speeds of the AVPlayer. 140e41f4b71Sopenharmony_ci 141e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 142e41f4b71Sopenharmony_ci 143e41f4b71Sopenharmony_ci**Since**: 11 144e41f4b71Sopenharmony_ci 145e41f4b71Sopenharmony_ci 146e41f4b71Sopenharmony_ci### AVPlayerBufferingType 147e41f4b71Sopenharmony_ci 148e41f4b71Sopenharmony_ci``` 149e41f4b71Sopenharmony_citypedef enum AVPlayerBufferingType AVPlayerBufferingType 150e41f4b71Sopenharmony_ci``` 151e41f4b71Sopenharmony_ci 152e41f4b71Sopenharmony_ci**Description** 153e41f4b71Sopenharmony_ci 154e41f4b71Sopenharmony_ciDefines an enum for the types of buffer messages of the AVPlayer. 155e41f4b71Sopenharmony_ci 156e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 157e41f4b71Sopenharmony_ci 158e41f4b71Sopenharmony_ci**Since**: 12 159e41f4b71Sopenharmony_ci 160e41f4b71Sopenharmony_ci 161e41f4b71Sopenharmony_ci### AVPlayerCallback 162e41f4b71Sopenharmony_ci 163e41f4b71Sopenharmony_ci``` 164e41f4b71Sopenharmony_citypedef struct AVPlayerCallback AVPlayerCallback 165e41f4b71Sopenharmony_ci``` 166e41f4b71Sopenharmony_ci 167e41f4b71Sopenharmony_ci**Description** 168e41f4b71Sopenharmony_ci 169e41f4b71Sopenharmony_ciContains the set of the **OH_AVPlayerOnInfo** and **OH_AVPlayerOnInfo** callback function pointers. To ensure the normal running of **OH_AVPlayer**, you must register the instance of this struct with the **OH_AVPlayer** instance and process the information reported by the callback functions. 170e41f4b71Sopenharmony_ci 171e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 172e41f4b71Sopenharmony_ci 173e41f4b71Sopenharmony_ci**Since**: 11 174e41f4b71Sopenharmony_ci 175e41f4b71Sopenharmony_ci**Deprecated from**: 12 176e41f4b71Sopenharmony_ci 177e41f4b71Sopenharmony_ci**Substitute**: [OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback) and [OH_AVPlayerOnErrorCallback](#oh_avplayeronerrorcallback) 178e41f4b71Sopenharmony_ci 179e41f4b71Sopenharmony_ci**Parameters** 180e41f4b71Sopenharmony_ci 181e41f4b71Sopenharmony_ci| Name| Description| 182e41f4b71Sopenharmony_ci| -------- | -------- | 183e41f4b71Sopenharmony_ci| onInfo | Callback for AVPlayer message information. For details about the available options, see [OH_AVPlayerOnInfo](#oh_avplayeroninfo).| 184e41f4b71Sopenharmony_ci| onError | Callback for AVPlayer error information. For details about the available options, see [OH_AVPlayerOnError](#oh_avplayeronerror).| 185e41f4b71Sopenharmony_ci 186e41f4b71Sopenharmony_ci 187e41f4b71Sopenharmony_ci### AVPlayerOnInfoType 188e41f4b71Sopenharmony_ci 189e41f4b71Sopenharmony_ci``` 190e41f4b71Sopenharmony_citypedef enum AVPlayerOnInfoType AVPlayerOnInfoType 191e41f4b71Sopenharmony_ci``` 192e41f4b71Sopenharmony_ci 193e41f4b71Sopenharmony_ci**Description** 194e41f4b71Sopenharmony_ci 195e41f4b71Sopenharmony_ciDefines an enum for the types of messages received by the AVPlayer. 196e41f4b71Sopenharmony_ci 197e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 198e41f4b71Sopenharmony_ci 199e41f4b71Sopenharmony_ci**Since**: 11 200e41f4b71Sopenharmony_ci 201e41f4b71Sopenharmony_ci 202e41f4b71Sopenharmony_ci### AVPlayerSeekMode 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_ci``` 205e41f4b71Sopenharmony_citypedef enum AVPlayerSeekMode AVPlayerSeekMode 206e41f4b71Sopenharmony_ci``` 207e41f4b71Sopenharmony_ci 208e41f4b71Sopenharmony_ci**Description** 209e41f4b71Sopenharmony_ci 210e41f4b71Sopenharmony_ciDefines an enum for the seek modes of the AVPlayer. 211e41f4b71Sopenharmony_ci 212e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 213e41f4b71Sopenharmony_ci 214e41f4b71Sopenharmony_ci**Since**: 11 215e41f4b71Sopenharmony_ci 216e41f4b71Sopenharmony_ci 217e41f4b71Sopenharmony_ci### AVPlayerState 218e41f4b71Sopenharmony_ci 219e41f4b71Sopenharmony_ci``` 220e41f4b71Sopenharmony_citypedef enum AVPlayerState AVPlayerState 221e41f4b71Sopenharmony_ci``` 222e41f4b71Sopenharmony_ci 223e41f4b71Sopenharmony_ci**Description** 224e41f4b71Sopenharmony_ci 225e41f4b71Sopenharmony_ciDefines an enum for the AVPlayer states. 226e41f4b71Sopenharmony_ci 227e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 228e41f4b71Sopenharmony_ci 229e41f4b71Sopenharmony_ci**Since**: 11 230e41f4b71Sopenharmony_ci 231e41f4b71Sopenharmony_ci 232e41f4b71Sopenharmony_ci### DRM_MediaKeySystemInfo 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ci``` 235e41f4b71Sopenharmony_citypedef struct DRM_MediaKeySystemInfo DRM_MediaKeySystemInfo 236e41f4b71Sopenharmony_ci``` 237e41f4b71Sopenharmony_ci 238e41f4b71Sopenharmony_ci**Description** 239e41f4b71Sopenharmony_ci 240e41f4b71Sopenharmony_ciDefines a struct for the media key system information. 241e41f4b71Sopenharmony_ci 242e41f4b71Sopenharmony_ci**Since**: 12 243e41f4b71Sopenharmony_ci 244e41f4b71Sopenharmony_ci 245e41f4b71Sopenharmony_ci### MediaKeySession 246e41f4b71Sopenharmony_ci 247e41f4b71Sopenharmony_ci``` 248e41f4b71Sopenharmony_citypedef struct MediaKeySession MediaKeySession 249e41f4b71Sopenharmony_ci``` 250e41f4b71Sopenharmony_ci 251e41f4b71Sopenharmony_ci**Description** 252e41f4b71Sopenharmony_ci 253e41f4b71Sopenharmony_ciDefines a struct for the media key session. 254e41f4b71Sopenharmony_ci 255e41f4b71Sopenharmony_ci**Since**: 12 256e41f4b71Sopenharmony_ci 257e41f4b71Sopenharmony_ci 258e41f4b71Sopenharmony_ci### OH_AVPlayerOnError 259e41f4b71Sopenharmony_ci 260e41f4b71Sopenharmony_ci``` 261e41f4b71Sopenharmony_citypedef void(* OH_AVPlayerOnError) (OH_AVPlayer *player, int32_t errorCode, const char *errorMsg) 262e41f4b71Sopenharmony_ci``` 263e41f4b71Sopenharmony_ci 264e41f4b71Sopenharmony_ci**Description** 265e41f4b71Sopenharmony_ci 266e41f4b71Sopenharmony_ciDefines the callback when an error occurs in the AVPlayer. This type is available in API version 9 or later. 267e41f4b71Sopenharmony_ci 268e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 269e41f4b71Sopenharmony_ci 270e41f4b71Sopenharmony_ci**Since**: 11 271e41f4b71Sopenharmony_ci 272e41f4b71Sopenharmony_ci**Deprecated from**: 12 273e41f4b71Sopenharmony_ci 274e41f4b71Sopenharmony_ci**Substitute**: [OH_AVPlayerOnErrorCallback](#oh_avplayeronerrorcallback) 275e41f4b71Sopenharmony_ci 276e41f4b71Sopenharmony_ci**Parameters** 277e41f4b71Sopenharmony_ci 278e41f4b71Sopenharmony_ci| Name| Description| 279e41f4b71Sopenharmony_ci| -------- | -------- | 280e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance. | 281e41f4b71Sopenharmony_ci| errorCode | Error code.<br>**AV_ERR_NO_MEMORY**: No memory. The value is **1**.<br>**AV_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The value is **2**.<br>**AV_ERR_INVALID_VAL**: Invalid value. The value is **3**.<br>**AV_ERR_IO**: I/O error. The value is **4**.<br>**AV_ERR_TIMEOUT**: Timeout. The value is **5**.<br>**AV_ERR_UNKNOWN**: Unknown error. The value is **6**.<br>**AV_ERR_SERVICE_DIED**: The service is dead. The value is **7**.<br>**AV_ERR_INVALID_STATE**: The operation is not supported in the current state. The value is **8**.<br>**AV_ERR_UNSUPPORT**: The function is not supported. The value is **9**.<br>**AV_ERR_EXTEND_START**: Initial value for extended error codes. The value is **100**.| 282e41f4b71Sopenharmony_ci| errorMsg | Pointer to an error message. | 283e41f4b71Sopenharmony_ci 284e41f4b71Sopenharmony_ci 285e41f4b71Sopenharmony_ci### OH_AVPlayerOnErrorCallback 286e41f4b71Sopenharmony_ci 287e41f4b71Sopenharmony_ci``` 288e41f4b71Sopenharmony_citypedef void(* OH_AVPlayerOnErrorCallback) (OH_AVPlayer *player, int32_t errorCode, const char *errorMsg, void *userData) 289e41f4b71Sopenharmony_ci``` 290e41f4b71Sopenharmony_ci 291e41f4b71Sopenharmony_ci**Description** 292e41f4b71Sopenharmony_ci 293e41f4b71Sopenharmony_ciDefines the callback invoked when an error occurs in the AVPlayer. If this callback is successfully set, the **OH_AVPlayerOnError** function will not be invoked. 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 296e41f4b71Sopenharmony_ci 297e41f4b71Sopenharmony_ci**Since**: 12 298e41f4b71Sopenharmony_ci 299e41f4b71Sopenharmony_ci**Parameters** 300e41f4b71Sopenharmony_ci 301e41f4b71Sopenharmony_ci| Name| Description| 302e41f4b71Sopenharmony_ci| -------- | -------- | 303e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance. | 304e41f4b71Sopenharmony_ci| errorCode | Error code.<br>**AV_ERR_NO_MEMORY**: No memory. The value is **1**.<br>**AV_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The value is **2**.<br>**AV_ERR_INVALID_VAL**: Invalid value. The value is **3**.<br>**AV_ERR_IO**: I/O error. The value is **4**.<br>**AV_ERR_TIMEOUT**: Timeout. The value is **5**.<br>**AV_ERR_UNKNOWN**: Unknown error. The value is **6**.<br>**AV_ERR_SERVICE_DIED**: The service is dead. The value is **7**.<br>**AV_ERR_INVALID_STATE**: The operation is not supported in the current state. The value is **8**.<br>**AV_ERR_UNSUPPORT**: The function is not supported. The value is **9**.<br>**AV_ERR_EXTEND_START**: Initial value for extended error codes. The value is **100**.| 305e41f4b71Sopenharmony_ci| errorMsg | Pointer to the error message. | 306e41f4b71Sopenharmony_ci| userData | Pointer to the user data passed in. The same data is returned. | 307e41f4b71Sopenharmony_ci 308e41f4b71Sopenharmony_ci 309e41f4b71Sopenharmony_ci### OH_AVPlayerOnInfo 310e41f4b71Sopenharmony_ci 311e41f4b71Sopenharmony_ci``` 312e41f4b71Sopenharmony_citypedef void(* OH_AVPlayerOnInfo) (OH_AVPlayer *player, AVPlayerOnInfoType type, int32_t extra) 313e41f4b71Sopenharmony_ci``` 314e41f4b71Sopenharmony_ci 315e41f4b71Sopenharmony_ci**Description** 316e41f4b71Sopenharmony_ciDefines the callback invoked when the AVPlayer receives a message. 317e41f4b71Sopenharmony_ci 318e41f4b71Sopenharmony_ciThe following table lists the mappings between **type** and **extra** values. 319e41f4b71Sopenharmony_ci 320e41f4b71Sopenharmony_ci| Value of type| Value of extra| 321e41f4b71Sopenharmony_ci| -------- | -------- | 322e41f4b71Sopenharmony_ci| AV_INFO_TYPE_SEEKDONE | Message returned when seeking to a playback position is complete. **extra** indicates the position after the seek operation.| 323e41f4b71Sopenharmony_ci| AV_INFO_TYPE_SPEEDDONE | Message returned when the playback speed setting is complete. **extra** indicates the playback speed. For details about the available options, see [AVPlaybackSpeed](#avplaybackspeed-1).| 324e41f4b71Sopenharmony_ci| AV_INFO_TYPE_BITRATEDONE | Message returned when the bit rate setting is complete. **extra** indicates the bit rate.| 325e41f4b71Sopenharmony_ci| AV_INFO_TYPE_EOS | Message returned when the playback is complete.| 326e41f4b71Sopenharmony_ci| AV_INFO_TYPE_STATE_CHANGE | Message returned when the AVPlayer state changes. **extra** indicates the new state. For details about the available options, see [AVPlayerState](#avplayerstate-1).| 327e41f4b71Sopenharmony_ci| AV_INFO_TYPE_POSITION_UPDATE | Message returned when the playback position changes. **extra** indicates the current position.| 328e41f4b71Sopenharmony_ci| AV_INFO_TYPE_MESSAGE | Message returned when video rendering starts. **extra** indicates the first video frame rendered.| 329e41f4b71Sopenharmony_ci| AV_INFO_TYPE_VOLUME_CHANGE | Message returned when the playback volume changes. **extra** is not defined in this scenario.| 330e41f4b71Sopenharmony_ci| AV_INFO_TYPE_RESOLUTION_CHANGE | Message returned when the video size is obtained for the first time or the video size is updated. **extra** is not defined in this scenario.| 331e41f4b71Sopenharmony_ci| AV_INFO_TYPE_BUFFERING_UPDATE | Message returned when multi-queue buffering changes. **extra** indicates the video duration.| 332e41f4b71Sopenharmony_ci| AV_INFO_TYPE_BITRATE_COLLECT | Message returned to report the HLS video bit rates. Each bit rate has been converted into a uint8_t byte array during the reporting. You need to forcibly convert the uint8_t byte array into a uint32_t integer array. | 333e41f4b71Sopenharmony_ci| AV_INFO_TYPE_INTERRUPT_EVENT | Message returned when the audio focus changes. **extra** indicates the hints provided along with audio interruption. For details about the available options, see [OH_AudioInterrupt_Hint](../apis-audio-kit/_o_h_audio.md#oh_audiointerrupt_hint). The application can determine whether to perform further processing based on the hint.| 334e41f4b71Sopenharmony_ci| AV_INFO_TYPE_DURATION_UPDATE | Message returned when the playback duration changes. **extra** indicates the video duration.| 335e41f4b71Sopenharmony_ci| AV_INFO_TYPE_IS_LIVE_STREAM | Message returned when live streams are played. **extra** indicates whether the stream is a live stream. The value **0** means a non-live stream, and **1** means a live stream.| 336e41f4b71Sopenharmony_ci| AV_INFO_TYPE_TRACKCHANGE | Message returned when the track changes. **extra** is not defined in this scenario.| 337e41f4b71Sopenharmony_ci| AV_INFO_TYPE_TRACK_INFO_UPDATE |Message returned when the track information updates. **extra** is not defined in this scenario.| 338e41f4b71Sopenharmony_ci| AV_INFO_TYPE_SUBTITLE_UPDATE | Message returned when the subtitle information changes. **extra** is not defined in this scenario.| 339e41f4b71Sopenharmony_ci| AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE | Message returned when the audio output device changes. **extra** indicates the device change reason. For details about the available options, see [OH_AudioStream_DeviceChangeReason](../apis-audio-kit/_o_h_audio.md#oh_audiostream_devicechangereason).| 340e41f4b71Sopenharmony_ci 341e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 342e41f4b71Sopenharmony_ci 343e41f4b71Sopenharmony_ci**Since**: 11 344e41f4b71Sopenharmony_ci 345e41f4b71Sopenharmony_ci**Deprecated from**: 12 346e41f4b71Sopenharmony_ci 347e41f4b71Sopenharmony_ci**Substitute**: [OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback) 348e41f4b71Sopenharmony_ci 349e41f4b71Sopenharmony_ci**Parameters** 350e41f4b71Sopenharmony_ci 351e41f4b71Sopenharmony_ci| Name| Description| 352e41f4b71Sopenharmony_ci| -------- | -------- | 353e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance. | 354e41f4b71Sopenharmony_ci| type | Message type. For details about the available options, see [AVPlayerOnInfoType](#avplayeroninfotype-1). For details about the mappings between **type** and **extra** values, see the function description.| 355e41f4b71Sopenharmony_ci| extra | Other information, such as the start time and position of the media file to play. | 356e41f4b71Sopenharmony_ci 357e41f4b71Sopenharmony_ci 358e41f4b71Sopenharmony_ci### OH_AVPlayerOnInfoCallback 359e41f4b71Sopenharmony_ci 360e41f4b71Sopenharmony_ci``` 361e41f4b71Sopenharmony_citypedef void(* OH_AVPlayerOnInfoCallback) (OH_AVPlayer *player, AVPlayerOnInfoType type, OH_AVFormat *infoBody, void *userData) 362e41f4b71Sopenharmony_ci``` 363e41f4b71Sopenharmony_ci 364e41f4b71Sopenharmony_ci**Description** 365e41f4b71Sopenharmony_ci 366e41f4b71Sopenharmony_ciDefines the callback invoked when the AVPlayer receives a message. If this callback is successfully set, the **OH_AVPlayerOnInfo** function will not be invoked. 367e41f4b71Sopenharmony_ci 368e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 369e41f4b71Sopenharmony_ci 370e41f4b71Sopenharmony_ci**Since**: 12 371e41f4b71Sopenharmony_ci 372e41f4b71Sopenharmony_ci**Parameters** 373e41f4b71Sopenharmony_ci 374e41f4b71Sopenharmony_ci| Name| Description| 375e41f4b71Sopenharmony_ci| -------- | -------- | 376e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance. | 377e41f4b71Sopenharmony_ci| type | Message type. For details about the available options, see [AVPlayerOnInfoType](#avplayeroninfotype-1). | 378e41f4b71Sopenharmony_ci| infoBody | Pointer to the message. The pointer is valid only in this callback. | 379e41f4b71Sopenharmony_ci| userData | Pointer to the user data passed in. The same data is returned. | 380e41f4b71Sopenharmony_ci 381e41f4b71Sopenharmony_ci 382e41f4b71Sopenharmony_ci### Player_MediaKeySystemInfoCallback 383e41f4b71Sopenharmony_ci 384e41f4b71Sopenharmony_ci``` 385e41f4b71Sopenharmony_citypedef void(* Player_MediaKeySystemInfoCallback) (OH_AVPlayer *player, DRM_MediaKeySystemInfo *mediaKeySystemInfo) 386e41f4b71Sopenharmony_ci``` 387e41f4b71Sopenharmony_ci 388e41f4b71Sopenharmony_ci**Description** 389e41f4b71Sopenharmony_ci 390e41f4b71Sopenharmony_ciDefines the callback invoked when media key system information of the AVPlayer is updated. 391e41f4b71Sopenharmony_ci 392e41f4b71Sopenharmony_ci**Since**: 12 393e41f4b71Sopenharmony_ci 394e41f4b71Sopenharmony_ci**Parameters** 395e41f4b71Sopenharmony_ci 396e41f4b71Sopenharmony_ci| Name| Description| 397e41f4b71Sopenharmony_ci| -------- | -------- | 398e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance. | 399e41f4b71Sopenharmony_ci| mediaKeySystemInfo | Pointer to the media key system information. | 400e41f4b71Sopenharmony_ci 401e41f4b71Sopenharmony_ci**Returns** 402e41f4b71Sopenharmony_ci 403e41f4b71Sopenharmony_civoid 404e41f4b71Sopenharmony_ci 405e41f4b71Sopenharmony_ci 406e41f4b71Sopenharmony_ci## Enum Description 407e41f4b71Sopenharmony_ci 408e41f4b71Sopenharmony_ci 409e41f4b71Sopenharmony_ci### AVPlaybackSpeed 410e41f4b71Sopenharmony_ci 411e41f4b71Sopenharmony_ci``` 412e41f4b71Sopenharmony_cienum AVPlaybackSpeed 413e41f4b71Sopenharmony_ci``` 414e41f4b71Sopenharmony_ci 415e41f4b71Sopenharmony_ci**Description** 416e41f4b71Sopenharmony_ci 417e41f4b71Sopenharmony_ciEnumerates the playback speeds of the AVPlayer. 418e41f4b71Sopenharmony_ci 419e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 420e41f4b71Sopenharmony_ci 421e41f4b71Sopenharmony_ci**Since**: 11 422e41f4b71Sopenharmony_ci 423e41f4b71Sopenharmony_ci| Value| Description| 424e41f4b71Sopenharmony_ci| -------- | -------- | 425e41f4b71Sopenharmony_ci| AV_SPEED_FORWARD_0_75_X | Plays the video at 0.75 times the normal speed.| 426e41f4b71Sopenharmony_ci| AV_SPEED_FORWARD_1_00_X | Plays the video at the normal speed.| 427e41f4b71Sopenharmony_ci| AV_SPEED_FORWARD_1_25_X | Plays the video at 1.25 times the normal speed.| 428e41f4b71Sopenharmony_ci| AV_SPEED_FORWARD_1_75_X | Plays the video at 1.75 times the normal speed.| 429e41f4b71Sopenharmony_ci| AV_SPEED_FORWARD_2_00_X | Plays the video at 2.0 times the normal speed.| 430e41f4b71Sopenharmony_ci| AV_SPEED_FORWARD_0_50_X | Plays the video at 0.5 times the normal speed.<br>**Since**: 12| 431e41f4b71Sopenharmony_ci| AV_SPEED_FORWARD_1_50_X | Plays the video at 1.5 times the normal speed.<br>**Since**: 12| 432e41f4b71Sopenharmony_ci 433e41f4b71Sopenharmony_ci 434e41f4b71Sopenharmony_ci### AVPlayerBufferingType 435e41f4b71Sopenharmony_ci 436e41f4b71Sopenharmony_ci``` 437e41f4b71Sopenharmony_cienum AVPlayerBufferingType 438e41f4b71Sopenharmony_ci``` 439e41f4b71Sopenharmony_ci 440e41f4b71Sopenharmony_ci**Description** 441e41f4b71Sopenharmony_ci 442e41f4b71Sopenharmony_ciEnumerates the types of buffer messages of the AVPlayer. 443e41f4b71Sopenharmony_ci 444e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 445e41f4b71Sopenharmony_ci 446e41f4b71Sopenharmony_ci**Since**: 12 447e41f4b71Sopenharmony_ci 448e41f4b71Sopenharmony_ci| Value| Description| 449e41f4b71Sopenharmony_ci| -------- | -------- | 450e41f4b71Sopenharmony_ci| AVPLAYER_BUFFERING_START | Buffering start message. | 451e41f4b71Sopenharmony_ci| AVPLAYER_BUFFERING_END | Buffering end message. | 452e41f4b71Sopenharmony_ci| AVPLAYER_BUFFERING_PERCENT | Buffer execution progress, in percentage. The value is an integer in the range [0, 100]. | 453e41f4b71Sopenharmony_ci| AVPLAYER_BUFFERING_CACHED_DURATION | Duration that cached data can be played, in milliseconds. | 454e41f4b71Sopenharmony_ci 455e41f4b71Sopenharmony_ci 456e41f4b71Sopenharmony_ci### AVPlayerOnInfoType 457e41f4b71Sopenharmony_ci 458e41f4b71Sopenharmony_ci``` 459e41f4b71Sopenharmony_cienum AVPlayerOnInfoType 460e41f4b71Sopenharmony_ci``` 461e41f4b71Sopenharmony_ci 462e41f4b71Sopenharmony_ci**Description** 463e41f4b71Sopenharmony_ci 464e41f4b71Sopenharmony_ciEnumerates the types of messages received by the AVPlayer. 465e41f4b71Sopenharmony_ci 466e41f4b71Sopenharmony_ciThe enum can be used in [OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback) and [OH_AVPlayerOnInfo (deprecated)](#oh_avplayeroninfo) to indicate the type of information received by the AVPlayer. 467e41f4b71Sopenharmony_ci 468e41f4b71Sopenharmony_ci- Since API version 12, you are advised to use [OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback) instead. Different information (**infoBody**) can be obtained for different **OnInfo** types. **infoBody** contains the key-value pairs. For details, see the following enumerated value table. 469e41f4b71Sopenharmony_ci 470e41f4b71Sopenharmony_ci- If you are using API version 11 for development, use **OH_AVPlayerOnInfo (deprecated)**. For details about the mappings used in this deprecated API, see [OH_AVPlayerOnInfo API Description](#oh_avplayeroninfo). 471e41f4b71Sopenharmony_ci 472e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 473e41f4b71Sopenharmony_ci 474e41f4b71Sopenharmony_ci**Since**: 11 475e41f4b71Sopenharmony_ci 476e41f4b71Sopenharmony_ci| Value| Description| 477e41f4b71Sopenharmony_ci| -------- | -------- | 478e41f4b71Sopenharmony_ci| AV_INFO_TYPE_SEEKDONE | Message returned when seeking to a playback position is complete.<br>If **key** is set to **OH_PLAYER_SEEK_POSITION**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value.| 479e41f4b71Sopenharmony_ci| AV_INFO_TYPE_SPEEDDONE | Message returned when the playback speed setting is complete.<br>If **key** is set to **OH_PLAYER_PLAYBACK_SPEED**, the value is an enumerated value of [AVPlaybackSpeed](#avplaybackspeed-1). The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value and forcibly converts the value to an enumerated value of [AVPlaybackSpeed](#avplaybackspeed-1).| 480e41f4b71Sopenharmony_ci| AV_INFO_TYPE_BITRATEDONE | Message returned when the bit rate setting is complete.<br>If **key** is set to **OH_PLAYER_BITRATE**, the value type is uint32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value and forcibly converts the value to the uint32_t type.| 481e41f4b71Sopenharmony_ci| AV_INFO_TYPE_EOS | Message returned when the playback is complete.| 482e41f4b71Sopenharmony_ci| AV_INFO_TYPE_STATE_CHANGE | Message returned when the AVPlayer state changes.<br>- If **key** is set to **OH_PLAYER_STATE**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value and forcibly converts the value to an enumerated value of [AVPlayerState](#avplayerstate-1).<br>- If **key** is set to **OH_PLAYER_STATE_CHANGE_REASON**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value. The value **1** means that the change is triggered by user operations, and **2** means that the change is triggered by the system.| 483e41f4b71Sopenharmony_ci| AV_INFO_TYPE_POSITION_UPDATE | Message returned when the playback position changes.<br>If **key** is set to **OH_PLAYER_CURRENT_POSITION**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value.| 484e41f4b71Sopenharmony_ci| AV_INFO_TYPE_MESSAGE | Message returned when video rendering starts.<br>If **key** is set to **OH_PLAYER_MESSAGE_TYPE**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value. The value **1** means that video rendering starts.| 485e41f4b71Sopenharmony_ci| AV_INFO_TYPE_VOLUME_CHANGE | Message returned when the playback volume changes.<br>If **key** is set to **OH_PLAYER_VOLUME**, the value type is float. The system uses float to transfer the value, and the application uses float to obtain the value. The value range is [0.0, 1.0].| 486e41f4b71Sopenharmony_ci| AV_INFO_TYPE_RESOLUTION_CHANGE | Message returned when the video size is obtained for the first time or the video size is updated.<br>If **key** is set to **OH_PLAYER_VIDEO_WIDTH** or **OH_PLAYER_VIDEO_HEIGHT**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value.| 487e41f4b71Sopenharmony_ci| AV_INFO_TYPE_BUFFERING_UPDATE | Message returned when multi-queue buffering changes.<br>- If **key** is set to **OH_PLAYER_BUFFERING_TYPE**, the value type is [AVPlayerBufferingType](#avplayerbufferingtype-1). The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value and forcibly converts the value to an enumerated value of [AVPlayerBufferingType](#avplayerbufferingtype-1).<br>- If **key** is set to **OH_PLAYER_BUFFERING_VALUE**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value. This value is valid when the buffer update message type is **AVPLAYER_BUFFERING_PERCENT** or **AVPLAYER_BUFFERING_CACHED_DURATION**, which indicate the percentage of the buffer progress and the duration that the cached data can play, respectively.| 488e41f4b71Sopenharmony_ci| AV_INFO_TYPE_BITRATE_COLLECT | Message returned to report the HLS video bit rates.<br>If **key** is set to **OH_PLAYER_BITRATE_ARRAY**, the value type is uint8_t. The application uses a pointer variable of the uint8_t type to store the bit rate list and uses a variable of the size_t type to store the byte array length. Then it allocates several storage spaces of the uint32_t type to receive the bit rate integer of the uint32_t type, which is converted from the uint8_t byte array. | 489e41f4b71Sopenharmony_ci| AV_INFO_TYPE_INTERRUPT_EVENT | Message returned when the audio focus changes.<br>The value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value.<br>**key** can be set to any of the following values:<br>- **OH_PLAYER_AUDIO_INTERRUPT_TYPE**: The value **1** means that the audio interruption event starts, and **2** means that the event ends.<br>- **OH_PLAYER_AUDIO_INTERRUPT_FORCE**: The value **0** means forcible interruption (the system changes the audio playback status), and **1** means sharing interruption (the application changes the audio playback status).<br>- **OH_PLAYER_AUDIO_INTERRUPT_HINT**: The value **0** (NONE) means no hint; **1** (RESUME) means that the audio playback is resumed; **2** (PAUSE) means that the audio playback is paused and loses focus; **3** (STOP) means that the audio playback is stopped; **4** (DUCK) means that the audio volume is reduced; **5** (UNDUCK) means that the audio volume is restored.| 490e41f4b71Sopenharmony_ci| AV_INFO_TYPE_DURATION_UPDATE | Message returned when the playback duration changes.<br>If **key** is set to **OH_PLAYER_DURATION**, the value type is int64_t. The system uses int64_t to transfer the value, and the application uses int64_t to obtain the value.| 491e41f4b71Sopenharmony_ci| AV_INFO_TYPE_IS_LIVE_STREAM | Message returned when live streams are played.<br>If **key** is set to **OH_PLAYER_IS_LIVE_STREAM**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value. The value **0** means a non-live stream, and **1** means a live stream.| 492e41f4b71Sopenharmony_ci| AV_INFO_TYPE_TRACKCHANGE | Message returned when the track changes. **extra** is not defined in this scenario.| 493e41f4b71Sopenharmony_ci| AV_INFO_TYPE_TRACK_INFO_UPDATE |Message returned when the track information updates. **extra** is not defined in this scenario.| 494e41f4b71Sopenharmony_ci| AV_INFO_TYPE_SUBTITLE_UPDATE | Message returned when the subtitle information changes. **extra** is not defined in this scenario.| 495e41f4b71Sopenharmony_ci| AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE | Message returned when the audio output device changes.<br>If **key** is set to **OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value.| 496e41f4b71Sopenharmony_ci 497e41f4b71Sopenharmony_ci 498e41f4b71Sopenharmony_ci### AVPlayerSeekMode 499e41f4b71Sopenharmony_ci 500e41f4b71Sopenharmony_ci``` 501e41f4b71Sopenharmony_cienum AVPlayerSeekMode 502e41f4b71Sopenharmony_ci``` 503e41f4b71Sopenharmony_ci 504e41f4b71Sopenharmony_ci**Description** 505e41f4b71Sopenharmony_ci 506e41f4b71Sopenharmony_ciEnumerates the seek modes of the AVPlayer. 507e41f4b71Sopenharmony_ci 508e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 509e41f4b71Sopenharmony_ci 510e41f4b71Sopenharmony_ci**Since**: 11 511e41f4b71Sopenharmony_ci 512e41f4b71Sopenharmony_ci| Value| Description| 513e41f4b71Sopenharmony_ci| -------- | -------- | 514e41f4b71Sopenharmony_ci| AV_SEEK_NEXT_SYNC | Seeks to the next key frame at the specified position.| 515e41f4b71Sopenharmony_ci| AV_SEEK_PREVIOUS_SYNC | Seeks to the previous key frame at the specified position.| 516e41f4b71Sopenharmony_ci| AV_SEEK_CLOSEST | Seeks to the frame closest to the specified position.<br>**Since**: 12| 517e41f4b71Sopenharmony_ci 518e41f4b71Sopenharmony_ci 519e41f4b71Sopenharmony_ci### AVPlayerState 520e41f4b71Sopenharmony_ci 521e41f4b71Sopenharmony_ci``` 522e41f4b71Sopenharmony_cienum AVPlayerState 523e41f4b71Sopenharmony_ci``` 524e41f4b71Sopenharmony_ci 525e41f4b71Sopenharmony_ci**Description** 526e41f4b71Sopenharmony_ci 527e41f4b71Sopenharmony_ciEnumerates the AVPlayer states. 528e41f4b71Sopenharmony_ci 529e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 530e41f4b71Sopenharmony_ci 531e41f4b71Sopenharmony_ci**Since**: 11 532e41f4b71Sopenharmony_ci 533e41f4b71Sopenharmony_ci| Value| Description| 534e41f4b71Sopenharmony_ci| -------- | -------- | 535e41f4b71Sopenharmony_ci| AV_IDLE | The AVPlayer is idle.| 536e41f4b71Sopenharmony_ci| AV_INITIALIZED | The AVPlayer is initialized.| 537e41f4b71Sopenharmony_ci| AV_PREPARED | The AVPlayer is ready for playback.| 538e41f4b71Sopenharmony_ci| AV_PLAYING | The AVPlayer is playing.| 539e41f4b71Sopenharmony_ci| AV_PAUSED | The AVPlayer is paused.| 540e41f4b71Sopenharmony_ci| AV_STOPPED | The AVPlayer is stopped.| 541e41f4b71Sopenharmony_ci| AV_COMPLETED | The AVPlayer finishes playing.| 542e41f4b71Sopenharmony_ci| AV_RELEASED | The AVPlayer is released.| 543e41f4b71Sopenharmony_ci| AV_ERROR | An error occurs.| 544e41f4b71Sopenharmony_ci 545e41f4b71Sopenharmony_ci 546e41f4b71Sopenharmony_ci## Function Description 547e41f4b71Sopenharmony_ci 548e41f4b71Sopenharmony_ci 549e41f4b71Sopenharmony_ci### OH_AVPlayer_Create() 550e41f4b71Sopenharmony_ci 551e41f4b71Sopenharmony_ci``` 552e41f4b71Sopenharmony_ciOH_AVPlayer* OH_AVPlayer_Create (void) 553e41f4b71Sopenharmony_ci``` 554e41f4b71Sopenharmony_ci 555e41f4b71Sopenharmony_ci**Description** 556e41f4b71Sopenharmony_ci 557e41f4b71Sopenharmony_ciCreates an **OH_AVPlayer** instance. 558e41f4b71Sopenharmony_ci 559e41f4b71Sopenharmony_ci> **NOTE** 560e41f4b71Sopenharmony_ci> 561e41f4b71Sopenharmony_ci> You are advised to create a maximum of 16 **AVPlayer** instances for an application in both audio and video playback scenarios.<!--Del--> 562e41f4b71Sopenharmony_ci> The actual number of instances that can be created may be different. It depends on the specifications of the device chip in use. For example, in the case of RK3568, you are advised to create a maximum of 6 **AVPlayer** instances for an application in audio and video playback scenarios.<!--DelEnd--> 563e41f4b71Sopenharmony_ci 564e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 565e41f4b71Sopenharmony_ci 566e41f4b71Sopenharmony_ci**Since**: 11 567e41f4b71Sopenharmony_ci 568e41f4b71Sopenharmony_ci**Returns** 569e41f4b71Sopenharmony_ci 570e41f4b71Sopenharmony_ciReturns the pointer to the **OH_AVPlayer** instance created if the operation is successful; returns a null pointer otherwise. 571e41f4b71Sopenharmony_ci 572e41f4b71Sopenharmony_ciThe possible causes of an operation failure are as follows: 573e41f4b71Sopenharmony_ci 574e41f4b71Sopenharmony_ci1. The execution of **PlayerFactory::CreatePlayer** fails. 575e41f4b71Sopenharmony_ci2. The execution of **new PlayerObject** fails. 576e41f4b71Sopenharmony_ci 577e41f4b71Sopenharmony_ci 578e41f4b71Sopenharmony_ci### OH_AVPlayer_DeselectTrack() 579e41f4b71Sopenharmony_ci 580e41f4b71Sopenharmony_ci``` 581e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_DeselectTrack (OH_AVPlayer *player, int32_t index) 582e41f4b71Sopenharmony_ci``` 583e41f4b71Sopenharmony_ci 584e41f4b71Sopenharmony_ci**Description** 585e41f4b71Sopenharmony_ci 586e41f4b71Sopenharmony_ciDeselects an audio track. This function is not supported yet. 587e41f4b71Sopenharmony_ci 588e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 589e41f4b71Sopenharmony_ci 590e41f4b71Sopenharmony_ci**Since**: 11 591e41f4b71Sopenharmony_ci 592e41f4b71Sopenharmony_ci**Parameters** 593e41f4b71Sopenharmony_ci 594e41f4b71Sopenharmony_ci| Name| Description| 595e41f4b71Sopenharmony_ci| -------- | -------- | 596e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 597e41f4b71Sopenharmony_ci| index | Index of the track. | 598e41f4b71Sopenharmony_ci 599e41f4b71Sopenharmony_ci**Returns** 600e41f4b71Sopenharmony_ci 601e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 602e41f4b71Sopenharmony_ci 603e41f4b71Sopenharmony_ci**AV_ERR_OK**: The deselection is successful. 604e41f4b71Sopenharmony_ci 605e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player DeselectTrack** fails. 606e41f4b71Sopenharmony_ci 607e41f4b71Sopenharmony_ci 608e41f4b71Sopenharmony_ci### OH_AVPlayer_GetCurrentTime() 609e41f4b71Sopenharmony_ci 610e41f4b71Sopenharmony_ci``` 611e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_GetCurrentTime (OH_AVPlayer *player, int32_t *currentTime) 612e41f4b71Sopenharmony_ci``` 613e41f4b71Sopenharmony_ci 614e41f4b71Sopenharmony_ci**Description** 615e41f4b71Sopenharmony_ci 616e41f4b71Sopenharmony_ciObtains the playback position, in milliseconds. 617e41f4b71Sopenharmony_ci 618e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 619e41f4b71Sopenharmony_ci 620e41f4b71Sopenharmony_ci**Since**: 11 621e41f4b71Sopenharmony_ci 622e41f4b71Sopenharmony_ci**Parameters** 623e41f4b71Sopenharmony_ci 624e41f4b71Sopenharmony_ci| Name| Description| 625e41f4b71Sopenharmony_ci| -------- | -------- | 626e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 627e41f4b71Sopenharmony_ci| currentTime | Pointer to the playback position.| 628e41f4b71Sopenharmony_ci 629e41f4b71Sopenharmony_ci**Returns** 630e41f4b71Sopenharmony_ci 631e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 632e41f4b71Sopenharmony_ci 633e41f4b71Sopenharmony_ci**AV_ERR_OK**: The playback position is obtained. 634e41f4b71Sopenharmony_ci 635e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player GetCurrentTime** fails. 636e41f4b71Sopenharmony_ci 637e41f4b71Sopenharmony_ci 638e41f4b71Sopenharmony_ci### OH_AVPlayer_GetCurrentTrack() 639e41f4b71Sopenharmony_ci 640e41f4b71Sopenharmony_ci``` 641e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_GetCurrentTrack (OH_AVPlayer *player, int32_t trackType, int32_t *index) 642e41f4b71Sopenharmony_ci``` 643e41f4b71Sopenharmony_ci 644e41f4b71Sopenharmony_ci**Description** 645e41f4b71Sopenharmony_ci 646e41f4b71Sopenharmony_ciObtains the currently valid track. This function is not supported yet. 647e41f4b71Sopenharmony_ci 648e41f4b71Sopenharmony_ciYou can set the track to the prepared, playing, paused, or completed state. 649e41f4b71Sopenharmony_ci 650e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 651e41f4b71Sopenharmony_ci 652e41f4b71Sopenharmony_ci**Since**: 11 653e41f4b71Sopenharmony_ci 654e41f4b71Sopenharmony_ci**Parameters** 655e41f4b71Sopenharmony_ci 656e41f4b71Sopenharmony_ci| Name| Description| 657e41f4b71Sopenharmony_ci| -------- | -------- | 658e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 659e41f4b71Sopenharmony_ci| trackType | Media type. The value **0** means audio and **1** means video.| 660e41f4b71Sopenharmony_ci| index | Pointer to the index of the track.| 661e41f4b71Sopenharmony_ci 662e41f4b71Sopenharmony_ci**Returns** 663e41f4b71Sopenharmony_ci 664e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 665e41f4b71Sopenharmony_ci 666e41f4b71Sopenharmony_ci**AV_ERR_OK**: The track is obtained. 667e41f4b71Sopenharmony_ci 668e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player GetCurrentTrack** fails. 669e41f4b71Sopenharmony_ci 670e41f4b71Sopenharmony_ci 671e41f4b71Sopenharmony_ci### OH_AVPlayer_GetDuration() 672e41f4b71Sopenharmony_ci 673e41f4b71Sopenharmony_ci``` 674e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_GetDuration (OH_AVPlayer *player, int32_t *duration) 675e41f4b71Sopenharmony_ci``` 676e41f4b71Sopenharmony_ci 677e41f4b71Sopenharmony_ci**Description** 678e41f4b71Sopenharmony_ci 679e41f4b71Sopenharmony_ciObtains the total duration of a media file, in milliseconds. 680e41f4b71Sopenharmony_ci 681e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 682e41f4b71Sopenharmony_ci 683e41f4b71Sopenharmony_ci**Since**: 11 684e41f4b71Sopenharmony_ci 685e41f4b71Sopenharmony_ci**Parameters** 686e41f4b71Sopenharmony_ci 687e41f4b71Sopenharmony_ci| Name| Description| 688e41f4b71Sopenharmony_ci| -------- | -------- | 689e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 690e41f4b71Sopenharmony_ci| duration | Pointer to the total duration.| 691e41f4b71Sopenharmony_ci 692e41f4b71Sopenharmony_ci**Returns** 693e41f4b71Sopenharmony_ci 694e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 695e41f4b71Sopenharmony_ci 696e41f4b71Sopenharmony_ci**AV_ERR_OK**: The total duration is obtained. 697e41f4b71Sopenharmony_ci 698e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player GetDuration** fails. 699e41f4b71Sopenharmony_ci 700e41f4b71Sopenharmony_ci 701e41f4b71Sopenharmony_ci### OH_AVPlayer_GetMediaKeySystemInfo() 702e41f4b71Sopenharmony_ci 703e41f4b71Sopenharmony_ci``` 704e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_GetMediaKeySystemInfo (OH_AVPlayer *player, DRM_MediaKeySystemInfo *mediaKeySystemInfo) 705e41f4b71Sopenharmony_ci``` 706e41f4b71Sopenharmony_ci 707e41f4b71Sopenharmony_ci**Description** 708e41f4b71Sopenharmony_ci 709e41f4b71Sopenharmony_ciObtains the media key system information to create a media key session. 710e41f4b71Sopenharmony_ci 711e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 712e41f4b71Sopenharmony_ci 713e41f4b71Sopenharmony_ci**Since**: 12 714e41f4b71Sopenharmony_ci 715e41f4b71Sopenharmony_ci**Parameters** 716e41f4b71Sopenharmony_ci 717e41f4b71Sopenharmony_ci| Name| Description| 718e41f4b71Sopenharmony_ci| -------- | -------- | 719e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 720e41f4b71Sopenharmony_ci| mediaKeySystemInfo | Pointer to the media key system information.| 721e41f4b71Sopenharmony_ci 722e41f4b71Sopenharmony_ci**Returns** 723e41f4b71Sopenharmony_ci 724e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 725e41f4b71Sopenharmony_ci 726e41f4b71Sopenharmony_ci**AV_ERR_OK**: The setting is successful. 727e41f4b71Sopenharmony_ci 728e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the memory is insufficient. 729e41f4b71Sopenharmony_ci 730e41f4b71Sopenharmony_ci### OH_AVPlayer_GetPlaybackSpeed() 731e41f4b71Sopenharmony_ci 732e41f4b71Sopenharmony_ci``` 733e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_GetPlaybackSpeed (OH_AVPlayer *player, AVPlaybackSpeed *speed) 734e41f4b71Sopenharmony_ci``` 735e41f4b71Sopenharmony_ci 736e41f4b71Sopenharmony_ci**Description** 737e41f4b71Sopenharmony_ci 738e41f4b71Sopenharmony_ciObtains the playback speed of an AVPlayer. 739e41f4b71Sopenharmony_ci 740e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 741e41f4b71Sopenharmony_ci 742e41f4b71Sopenharmony_ci**Since**: 11 743e41f4b71Sopenharmony_ci 744e41f4b71Sopenharmony_ci**Parameters** 745e41f4b71Sopenharmony_ci 746e41f4b71Sopenharmony_ci| Name| Description| 747e41f4b71Sopenharmony_ci| -------- | -------- | 748e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 749e41f4b71Sopenharmony_ci| speed | Pointer to the playback speed. For details about the available options, see [AVPlaybackSpeed](#avplaybackspeed).| 750e41f4b71Sopenharmony_ci 751e41f4b71Sopenharmony_ci**Returns** 752e41f4b71Sopenharmony_ci 753e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 754e41f4b71Sopenharmony_ci 755e41f4b71Sopenharmony_ci**AV_ERR_OK**: The playback rate is obtained. 756e41f4b71Sopenharmony_ci 757e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player GetPlaybackSpeed** fails. 758e41f4b71Sopenharmony_ci 759e41f4b71Sopenharmony_ci 760e41f4b71Sopenharmony_ci### OH_AVPlayer_GetState() 761e41f4b71Sopenharmony_ci 762e41f4b71Sopenharmony_ci``` 763e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_GetState (OH_AVPlayer *player, AVPlayerState *state) 764e41f4b71Sopenharmony_ci``` 765e41f4b71Sopenharmony_ci 766e41f4b71Sopenharmony_ci**Description** 767e41f4b71Sopenharmony_ci 768e41f4b71Sopenharmony_ciObtains the AVPlayer state. 769e41f4b71Sopenharmony_ci 770e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 771e41f4b71Sopenharmony_ci 772e41f4b71Sopenharmony_ci**Since**: 11 773e41f4b71Sopenharmony_ci 774e41f4b71Sopenharmony_ci**Parameters** 775e41f4b71Sopenharmony_ci 776e41f4b71Sopenharmony_ci| Name| Description| 777e41f4b71Sopenharmony_ci| -------- | -------- | 778e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 779e41f4b71Sopenharmony_ci| state | Pointer to the state.| 780e41f4b71Sopenharmony_ci 781e41f4b71Sopenharmony_ci**Returns** 782e41f4b71Sopenharmony_ci 783e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 784e41f4b71Sopenharmony_ci 785e41f4b71Sopenharmony_ci**AV_ERR_OK**: The AVPlayer state is obtained. 786e41f4b71Sopenharmony_ci 787e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player GetState** fails. 788e41f4b71Sopenharmony_ci 789e41f4b71Sopenharmony_ci 790e41f4b71Sopenharmony_ci### OH_AVPlayer_GetVideoHeight() 791e41f4b71Sopenharmony_ci 792e41f4b71Sopenharmony_ci``` 793e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_GetVideoHeight (OH_AVPlayer *player, int32_t *videoHeight) 794e41f4b71Sopenharmony_ci``` 795e41f4b71Sopenharmony_ci 796e41f4b71Sopenharmony_ci**Description** 797e41f4b71Sopenharmony_ci 798e41f4b71Sopenharmony_ciObtains the video height. 799e41f4b71Sopenharmony_ci 800e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 801e41f4b71Sopenharmony_ci 802e41f4b71Sopenharmony_ci**Since**: 11 803e41f4b71Sopenharmony_ci 804e41f4b71Sopenharmony_ci**Parameters** 805e41f4b71Sopenharmony_ci 806e41f4b71Sopenharmony_ci| Name| Description| 807e41f4b71Sopenharmony_ci| -------- | -------- | 808e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 809e41f4b71Sopenharmony_ci| videoHeights | Pointer to the video height.| 810e41f4b71Sopenharmony_ci 811e41f4b71Sopenharmony_ci**Returns** 812e41f4b71Sopenharmony_ci 813e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 814e41f4b71Sopenharmony_ci 815e41f4b71Sopenharmony_ci**AV_ERR_OK**: The video height is obtained. 816e41f4b71Sopenharmony_ci 817e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer. 818e41f4b71Sopenharmony_ci 819e41f4b71Sopenharmony_ci 820e41f4b71Sopenharmony_ci### OH_AVPlayer_GetVideoWidth() 821e41f4b71Sopenharmony_ci 822e41f4b71Sopenharmony_ci``` 823e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_GetVideoWidth (OH_AVPlayer *player, int32_t *videoWidth) 824e41f4b71Sopenharmony_ci``` 825e41f4b71Sopenharmony_ci 826e41f4b71Sopenharmony_ci**Description** 827e41f4b71Sopenharmony_ci 828e41f4b71Sopenharmony_ciObtains the video width. 829e41f4b71Sopenharmony_ci 830e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 831e41f4b71Sopenharmony_ci 832e41f4b71Sopenharmony_ci**Since**: 11 833e41f4b71Sopenharmony_ci 834e41f4b71Sopenharmony_ci**Parameters** 835e41f4b71Sopenharmony_ci 836e41f4b71Sopenharmony_ci| Name| Description| 837e41f4b71Sopenharmony_ci| -------- | -------- | 838e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 839e41f4b71Sopenharmony_ci| videoWidth | Pointer to the video width.| 840e41f4b71Sopenharmony_ci 841e41f4b71Sopenharmony_ci**Returns** 842e41f4b71Sopenharmony_ci 843e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 844e41f4b71Sopenharmony_ci 845e41f4b71Sopenharmony_ci**AV_ERR_OK**: The video width is obtained. 846e41f4b71Sopenharmony_ci 847e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer. 848e41f4b71Sopenharmony_ci 849e41f4b71Sopenharmony_ci 850e41f4b71Sopenharmony_ci### OH_AVPlayer_IsLooping() 851e41f4b71Sopenharmony_ci 852e41f4b71Sopenharmony_ci``` 853e41f4b71Sopenharmony_cibool OH_AVPlayer_IsLooping (OH_AVPlayer *player) 854e41f4b71Sopenharmony_ci``` 855e41f4b71Sopenharmony_ci 856e41f4b71Sopenharmony_ci**Description** 857e41f4b71Sopenharmony_ci 858e41f4b71Sopenharmony_ciChecks whether an AVPlayer is looping. 859e41f4b71Sopenharmony_ci 860e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 861e41f4b71Sopenharmony_ci 862e41f4b71Sopenharmony_ci**Since**: 11 863e41f4b71Sopenharmony_ci 864e41f4b71Sopenharmony_ci**Parameters** 865e41f4b71Sopenharmony_ci 866e41f4b71Sopenharmony_ci| Name| Description| 867e41f4b71Sopenharmony_ci| -------- | -------- | 868e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 869e41f4b71Sopenharmony_ci 870e41f4b71Sopenharmony_ci**Returns** 871e41f4b71Sopenharmony_ci 872e41f4b71Sopenharmony_ciReturns **true** if the AVPlayer is looping; returns **false** if the AVPlayer is not looping or the input parameter **player** is a null pointer. 873e41f4b71Sopenharmony_ci 874e41f4b71Sopenharmony_ci 875e41f4b71Sopenharmony_ci### OH_AVPlayer_IsPlaying() 876e41f4b71Sopenharmony_ci 877e41f4b71Sopenharmony_ci``` 878e41f4b71Sopenharmony_cibool OH_AVPlayer_IsPlaying (OH_AVPlayer *player) 879e41f4b71Sopenharmony_ci``` 880e41f4b71Sopenharmony_ci 881e41f4b71Sopenharmony_ci**Description** 882e41f4b71Sopenharmony_ci 883e41f4b71Sopenharmony_ciChecks whether an AVPlayer is playing. 884e41f4b71Sopenharmony_ci 885e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 886e41f4b71Sopenharmony_ci 887e41f4b71Sopenharmony_ci**Since**: 11 888e41f4b71Sopenharmony_ci 889e41f4b71Sopenharmony_ci**Parameters** 890e41f4b71Sopenharmony_ci 891e41f4b71Sopenharmony_ci| Name| Description| 892e41f4b71Sopenharmony_ci| -------- | -------- | 893e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 894e41f4b71Sopenharmony_ci 895e41f4b71Sopenharmony_ci**Returns** 896e41f4b71Sopenharmony_ci 897e41f4b71Sopenharmony_ciReturns **true** if the AVPlayer is playing; returns **false** if the AVPlayer is not playing or the input parameter **player** is a null pointer. 898e41f4b71Sopenharmony_ci 899e41f4b71Sopenharmony_ci 900e41f4b71Sopenharmony_ci### OH_AVPlayer_Pause() 901e41f4b71Sopenharmony_ci 902e41f4b71Sopenharmony_ci``` 903e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_Pause (OH_AVPlayer *player) 904e41f4b71Sopenharmony_ci``` 905e41f4b71Sopenharmony_ci 906e41f4b71Sopenharmony_ci**Description** 907e41f4b71Sopenharmony_ci 908e41f4b71Sopenharmony_ciPauses playback. 909e41f4b71Sopenharmony_ci 910e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 911e41f4b71Sopenharmony_ci 912e41f4b71Sopenharmony_ci**Since**: 11 913e41f4b71Sopenharmony_ci 914e41f4b71Sopenharmony_ci**Parameters** 915e41f4b71Sopenharmony_ci 916e41f4b71Sopenharmony_ci| Name| Description| 917e41f4b71Sopenharmony_ci| -------- | -------- | 918e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 919e41f4b71Sopenharmony_ci 920e41f4b71Sopenharmony_ci**Returns** 921e41f4b71Sopenharmony_ci 922e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 923e41f4b71Sopenharmony_ci 924e41f4b71Sopenharmony_ci**AV_ERR_OK**: The **Pause** operation is added to the task queue. 925e41f4b71Sopenharmony_ci 926e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Pause** fails. 927e41f4b71Sopenharmony_ci 928e41f4b71Sopenharmony_ci 929e41f4b71Sopenharmony_ci### OH_AVPlayer_Play() 930e41f4b71Sopenharmony_ci 931e41f4b71Sopenharmony_ci``` 932e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_Play (OH_AVPlayer *player) 933e41f4b71Sopenharmony_ci``` 934e41f4b71Sopenharmony_ci 935e41f4b71Sopenharmony_ci**Description** 936e41f4b71Sopenharmony_ci 937e41f4b71Sopenharmony_ciStarts playback. 938e41f4b71Sopenharmony_ci 939e41f4b71Sopenharmony_ciThis function must be called after **Prepare**. In other words, you can call this function when the AVPlayer is in the prepared state. 940e41f4b71Sopenharmony_ci 941e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 942e41f4b71Sopenharmony_ci 943e41f4b71Sopenharmony_ci**Since**: 11 944e41f4b71Sopenharmony_ci 945e41f4b71Sopenharmony_ci**Parameters** 946e41f4b71Sopenharmony_ci 947e41f4b71Sopenharmony_ci| Name| Description| 948e41f4b71Sopenharmony_ci| -------- | -------- | 949e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 950e41f4b71Sopenharmony_ci 951e41f4b71Sopenharmony_ci**Returns** 952e41f4b71Sopenharmony_ci 953e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 954e41f4b71Sopenharmony_ci 955e41f4b71Sopenharmony_ci**AV_ERR_OK**: The playback starts. 956e41f4b71Sopenharmony_ci 957e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Play** fails. 958e41f4b71Sopenharmony_ci 959e41f4b71Sopenharmony_ci 960e41f4b71Sopenharmony_ci### OH_AVPlayer_Prepare() 961e41f4b71Sopenharmony_ci 962e41f4b71Sopenharmony_ci``` 963e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_Prepare (OH_AVPlayer *player) 964e41f4b71Sopenharmony_ci``` 965e41f4b71Sopenharmony_ci 966e41f4b71Sopenharmony_ci**Description** 967e41f4b71Sopenharmony_ci 968e41f4b71Sopenharmony_ciPrepares the playback environment and buffers media data. 969e41f4b71Sopenharmony_ci 970e41f4b71Sopenharmony_ciThis function must be called after **SetSource**. 971e41f4b71Sopenharmony_ci 972e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 973e41f4b71Sopenharmony_ci 974e41f4b71Sopenharmony_ci**Since**: 11 975e41f4b71Sopenharmony_ci 976e41f4b71Sopenharmony_ci**Parameters** 977e41f4b71Sopenharmony_ci 978e41f4b71Sopenharmony_ci| Name| Description| 979e41f4b71Sopenharmony_ci| -------- | -------- | 980e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 981e41f4b71Sopenharmony_ci 982e41f4b71Sopenharmony_ci**Returns** 983e41f4b71Sopenharmony_ci 984e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 985e41f4b71Sopenharmony_ci 986e41f4b71Sopenharmony_ci**AV_ERR_OK**: The **Prepare** operation is added to the task queue. 987e41f4b71Sopenharmony_ci 988e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Prepare** fails. 989e41f4b71Sopenharmony_ci 990e41f4b71Sopenharmony_ci 991e41f4b71Sopenharmony_ci### OH_AVPlayer_Release() 992e41f4b71Sopenharmony_ci 993e41f4b71Sopenharmony_ci``` 994e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_Release (OH_AVPlayer *player) 995e41f4b71Sopenharmony_ci``` 996e41f4b71Sopenharmony_ci 997e41f4b71Sopenharmony_ci**Description** 998e41f4b71Sopenharmony_ci 999e41f4b71Sopenharmony_ciAsynchronously releases an **OH_AVPlayer** instance. 1000e41f4b71Sopenharmony_ci 1001e41f4b71Sopenharmony_ciThe asynchronous function ensures the performance, but cannot ensure that the surface buffer of the playback window is released. You must ensure the lifecycle of the playback window. 1002e41f4b71Sopenharmony_ci 1003e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1004e41f4b71Sopenharmony_ci 1005e41f4b71Sopenharmony_ci**Since**: 11 1006e41f4b71Sopenharmony_ci 1007e41f4b71Sopenharmony_ci**Parameters** 1008e41f4b71Sopenharmony_ci 1009e41f4b71Sopenharmony_ci| Name| Description| 1010e41f4b71Sopenharmony_ci| -------- | -------- | 1011e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1012e41f4b71Sopenharmony_ci 1013e41f4b71Sopenharmony_ci**Returns** 1014e41f4b71Sopenharmony_ci 1015e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1016e41f4b71Sopenharmony_ci 1017e41f4b71Sopenharmony_ci**AV_ERR_OK**: The **Release** operation is added to the task queue. 1018e41f4b71Sopenharmony_ci 1019e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Release** fails. 1020e41f4b71Sopenharmony_ci 1021e41f4b71Sopenharmony_ci 1022e41f4b71Sopenharmony_ci### OH_AVPlayer_ReleaseSync() 1023e41f4b71Sopenharmony_ci 1024e41f4b71Sopenharmony_ci``` 1025e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_ReleaseSync (OH_AVPlayer *player) 1026e41f4b71Sopenharmony_ci``` 1027e41f4b71Sopenharmony_ci 1028e41f4b71Sopenharmony_ci**Description** 1029e41f4b71Sopenharmony_ci 1030e41f4b71Sopenharmony_ciSynchronously releases an **OH_AVPlayer** instance. 1031e41f4b71Sopenharmony_ci 1032e41f4b71Sopenharmony_ciThe synchronous function ensures that the display buffer of the playback window is released, with a long time. Therefore, you need to design an asynchronous mechanism. 1033e41f4b71Sopenharmony_ci 1034e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1035e41f4b71Sopenharmony_ci 1036e41f4b71Sopenharmony_ci**Since**: 11 1037e41f4b71Sopenharmony_ci 1038e41f4b71Sopenharmony_ci**Parameters** 1039e41f4b71Sopenharmony_ci 1040e41f4b71Sopenharmony_ci| Name| Description| 1041e41f4b71Sopenharmony_ci| -------- | -------- | 1042e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1043e41f4b71Sopenharmony_ci 1044e41f4b71Sopenharmony_ci**Returns** 1045e41f4b71Sopenharmony_ci 1046e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1047e41f4b71Sopenharmony_ci 1048e41f4b71Sopenharmony_ci**AV_ERR_OK**: The AVPlayer is released. 1049e41f4b71Sopenharmony_ci 1050e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player ReleaseSync** fails. 1051e41f4b71Sopenharmony_ci 1052e41f4b71Sopenharmony_ci### OH_AVPlayer_Reset() 1053e41f4b71Sopenharmony_ci 1054e41f4b71Sopenharmony_ci``` 1055e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_Reset (OH_AVPlayer *player) 1056e41f4b71Sopenharmony_ci``` 1057e41f4b71Sopenharmony_ci 1058e41f4b71Sopenharmony_ci**Description** 1059e41f4b71Sopenharmony_ci 1060e41f4b71Sopenharmony_ciRestores the AVPlayer to the initial state. 1061e41f4b71Sopenharmony_ci 1062e41f4b71Sopenharmony_ciAfter the function is called, you can call **SetSource** to set the media source to play, and then call **Prepare** and **Play** in sequence. 1063e41f4b71Sopenharmony_ci 1064e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1065e41f4b71Sopenharmony_ci 1066e41f4b71Sopenharmony_ci**Since**: 11 1067e41f4b71Sopenharmony_ci 1068e41f4b71Sopenharmony_ci**Parameters** 1069e41f4b71Sopenharmony_ci 1070e41f4b71Sopenharmony_ci| Name| Description| 1071e41f4b71Sopenharmony_ci| -------- | -------- | 1072e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1073e41f4b71Sopenharmony_ci 1074e41f4b71Sopenharmony_ci**Returns** 1075e41f4b71Sopenharmony_ci 1076e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1077e41f4b71Sopenharmony_ci 1078e41f4b71Sopenharmony_ci**AV_ERR_OK**: The **reset** operation is added to the task queue. 1079e41f4b71Sopenharmony_ci 1080e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Reset** fails. 1081e41f4b71Sopenharmony_ci 1082e41f4b71Sopenharmony_ci 1083e41f4b71Sopenharmony_ci### OH_AVPlayer_Seek() 1084e41f4b71Sopenharmony_ci 1085e41f4b71Sopenharmony_ci``` 1086e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_Seek (OH_AVPlayer *player, int32_t mSeconds, AVPlayerSeekMode mode) 1087e41f4b71Sopenharmony_ci``` 1088e41f4b71Sopenharmony_ci 1089e41f4b71Sopenharmony_ci**Description** 1090e41f4b71Sopenharmony_ci 1091e41f4b71Sopenharmony_ciSeeks to a playback position. 1092e41f4b71Sopenharmony_ci 1093e41f4b71Sopenharmony_ciThis function can be used when the AVPlayer is in the playing or paused state. 1094e41f4b71Sopenharmony_ci 1095e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1096e41f4b71Sopenharmony_ci 1097e41f4b71Sopenharmony_ci**Parameters** 1098e41f4b71Sopenharmony_ci 1099e41f4b71Sopenharmony_ci| Name| Description| 1100e41f4b71Sopenharmony_ci| -------- | -------- | 1101e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1102e41f4b71Sopenharmony_ci| mSeconds | Position to seek to, in ms.| 1103e41f4b71Sopenharmony_ci| mode | Seek mode. For details about the available options, see [AVPlayerSeekMode](#avplayerseekmode).| 1104e41f4b71Sopenharmony_ci 1105e41f4b71Sopenharmony_ci**Returns** 1106e41f4b71Sopenharmony_ci 1107e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1108e41f4b71Sopenharmony_ci 1109e41f4b71Sopenharmony_ciAV_ERR_OK: The seek operation is complete. 1110e41f4b71Sopenharmony_ci 1111e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Seek** fails. 1112e41f4b71Sopenharmony_ci 1113e41f4b71Sopenharmony_ci 1114e41f4b71Sopenharmony_ci### OH_AVPlayer_SelectBitRate() 1115e41f4b71Sopenharmony_ci 1116e41f4b71Sopenharmony_ci``` 1117e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SelectBitRate (OH_AVPlayer *player, uint32_t bitRate) 1118e41f4b71Sopenharmony_ci``` 1119e41f4b71Sopenharmony_ci 1120e41f4b71Sopenharmony_ci**Description** 1121e41f4b71Sopenharmony_ci 1122e41f4b71Sopenharmony_ciSets the bit rate used by an HLS player, 1123e41f4b71Sopenharmony_ci 1124e41f4b71Sopenharmony_ciin bit/s. This function is valid only for HLS network streams. By default, the player selects a proper bit rate and speed based on the network connection. You can set a bit rate available in the valid bit rates reported in **INFO_TYPE_BITRATE_COLLECT**. The player selects a bit rate that is lower than or closest to the specified bit rate for playback. When ready, you can query the selected bit rate. 1125e41f4b71Sopenharmony_ci 1126e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1127e41f4b71Sopenharmony_ci 1128e41f4b71Sopenharmony_ci**Since**: 11 1129e41f4b71Sopenharmony_ci 1130e41f4b71Sopenharmony_ci**Parameters** 1131e41f4b71Sopenharmony_ci 1132e41f4b71Sopenharmony_ci| Name| Description| 1133e41f4b71Sopenharmony_ci| -------- | -------- | 1134e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1135e41f4b71Sopenharmony_ci| bitRate | Bit rate, in kbit/s.| 1136e41f4b71Sopenharmony_ci 1137e41f4b71Sopenharmony_ci**Returns** 1138e41f4b71Sopenharmony_ci 1139e41f4b71Sopenharmony_ci**Returns** 1140e41f4b71Sopenharmony_ci 1141e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1142e41f4b71Sopenharmony_ci 1143e41f4b71Sopenharmony_ci**AV_ERR_OK**: The bit rate is set. 1144e41f4b71Sopenharmony_ci 1145e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SelectBitRate** fails. 1146e41f4b71Sopenharmony_ci 1147e41f4b71Sopenharmony_ci 1148e41f4b71Sopenharmony_ci### OH_AVPlayer_SelectTrack() 1149e41f4b71Sopenharmony_ci 1150e41f4b71Sopenharmony_ci``` 1151e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SelectTrack (OH_AVPlayer *player, int32_t index) 1152e41f4b71Sopenharmony_ci``` 1153e41f4b71Sopenharmony_ci 1154e41f4b71Sopenharmony_ci**Description** 1155e41f4b71Sopenharmony_ci 1156e41f4b71Sopenharmony_ciSelects an audio track. This function is not supported yet. 1157e41f4b71Sopenharmony_ci 1158e41f4b71Sopenharmony_ciBy default, the first audio stream with data is played. After the setting takes effect, the original track becomes invalid. This API sets the audio track to the ready state. 1159e41f4b71Sopenharmony_ci 1160e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1161e41f4b71Sopenharmony_ci 1162e41f4b71Sopenharmony_ci**Since**: 11 1163e41f4b71Sopenharmony_ci 1164e41f4b71Sopenharmony_ci**Parameters** 1165e41f4b71Sopenharmony_ci 1166e41f4b71Sopenharmony_ci| Name| Description| 1167e41f4b71Sopenharmony_ci| -------- | -------- | 1168e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1169e41f4b71Sopenharmony_ci| index | Index of the track.| 1170e41f4b71Sopenharmony_ci 1171e41f4b71Sopenharmony_ci**Returns** 1172e41f4b71Sopenharmony_ci 1173e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1174e41f4b71Sopenharmony_ci 1175e41f4b71Sopenharmony_ci**AV_ERR_OK**: A track is selected. 1176e41f4b71Sopenharmony_ci 1177e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SelectTrack** fails. 1178e41f4b71Sopenharmony_ci 1179e41f4b71Sopenharmony_ci 1180e41f4b71Sopenharmony_ci### OH_AVPlayer_SetAudioEffectMode() 1181e41f4b71Sopenharmony_ci 1182e41f4b71Sopenharmony_ci``` 1183e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetAudioEffectMode (OH_AVPlayer *player, OH_AudioStream_AudioEffectMode effectMode) 1184e41f4b71Sopenharmony_ci``` 1185e41f4b71Sopenharmony_ci 1186e41f4b71Sopenharmony_ci**Description** 1187e41f4b71Sopenharmony_ci 1188e41f4b71Sopenharmony_ciSets the audio effect mode for an AVPlayer. 1189e41f4b71Sopenharmony_ci 1190e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1191e41f4b71Sopenharmony_ci 1192e41f4b71Sopenharmony_ci**Since**: 12 1193e41f4b71Sopenharmony_ci 1194e41f4b71Sopenharmony_ci**Parameters** 1195e41f4b71Sopenharmony_ci 1196e41f4b71Sopenharmony_ci| Name| Description| 1197e41f4b71Sopenharmony_ci| -------- | -------- | 1198e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance. | 1199e41f4b71Sopenharmony_ci| interruptMode | Audio effect mode. For details about the available options, see [OH_AudioStream_AudioEffectMode](../apis-audio-kit/_o_h_audio.md#oh_audiostream_audioeffectmode). | 1200e41f4b71Sopenharmony_ci 1201e41f4b71Sopenharmony_ci**Returns** 1202e41f4b71Sopenharmony_ci 1203e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1204e41f4b71Sopenharmony_ci 1205e41f4b71Sopenharmony_ci**AV_ERR_OK**: The setting is successful. 1206e41f4b71Sopenharmony_ci 1207e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or **effectMode** is invalid. 1208e41f4b71Sopenharmony_ci 1209e41f4b71Sopenharmony_ci 1210e41f4b71Sopenharmony_ci### OH_AVPlayer_SetAudioInterruptMode() 1211e41f4b71Sopenharmony_ci 1212e41f4b71Sopenharmony_ci``` 1213e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetAudioInterruptMode (OH_AVPlayer *player, OH_AudioInterrupt_Mode interruptMode) 1214e41f4b71Sopenharmony_ci``` 1215e41f4b71Sopenharmony_ci 1216e41f4b71Sopenharmony_ci**Description** 1217e41f4b71Sopenharmony_ci 1218e41f4b71Sopenharmony_ciSets the audio interruption mode for an AVPlayer. 1219e41f4b71Sopenharmony_ci 1220e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1221e41f4b71Sopenharmony_ci 1222e41f4b71Sopenharmony_ci**Since**: 12 1223e41f4b71Sopenharmony_ci 1224e41f4b71Sopenharmony_ci**Parameters** 1225e41f4b71Sopenharmony_ci 1226e41f4b71Sopenharmony_ci| Name| Description| 1227e41f4b71Sopenharmony_ci| -------- | -------- | 1228e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance. | 1229e41f4b71Sopenharmony_ci| interruptMode | Audio interruption mode. For details about the available options, see [OH_AudioInterrupt_Mode](../apis-audio-kit/_o_h_audio.md#oh_audiointerrupt_mode). | 1230e41f4b71Sopenharmony_ci 1231e41f4b71Sopenharmony_ci**Returns** 1232e41f4b71Sopenharmony_ci 1233e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1234e41f4b71Sopenharmony_ci 1235e41f4b71Sopenharmony_ci**AV_ERR_OK**: The setting is successful. 1236e41f4b71Sopenharmony_ci 1237e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or **interruptMode** is invalid. 1238e41f4b71Sopenharmony_ci 1239e41f4b71Sopenharmony_ci 1240e41f4b71Sopenharmony_ci### OH_AVPlayer_SetAudioRendererInfo() 1241e41f4b71Sopenharmony_ci 1242e41f4b71Sopenharmony_ci``` 1243e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetAudioRendererInfo (OH_AVPlayer *player, OH_AudioStream_Usage streamUsage) 1244e41f4b71Sopenharmony_ci``` 1245e41f4b71Sopenharmony_ci 1246e41f4b71Sopenharmony_ci**Description** 1247e41f4b71Sopenharmony_ci 1248e41f4b71Sopenharmony_ciSets the audio stream type for an AVPlayer. 1249e41f4b71Sopenharmony_ci 1250e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1251e41f4b71Sopenharmony_ci 1252e41f4b71Sopenharmony_ci**Since**: 12 1253e41f4b71Sopenharmony_ci 1254e41f4b71Sopenharmony_ci**Parameters** 1255e41f4b71Sopenharmony_ci 1256e41f4b71Sopenharmony_ci| Name| Description| 1257e41f4b71Sopenharmony_ci| -------- | -------- | 1258e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance. | 1259e41f4b71Sopenharmony_ci| streamUsage | Audio stream type. For details about the available options, see [OH_AudioStream_Usage](../apis-audio-kit/_o_h_audio.md#oh_audiostream_usage). | 1260e41f4b71Sopenharmony_ci 1261e41f4b71Sopenharmony_ci**Returns** 1262e41f4b71Sopenharmony_ci 1263e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1264e41f4b71Sopenharmony_ci 1265e41f4b71Sopenharmony_ci**AV_ERR_OK**: The setting is successful. 1266e41f4b71Sopenharmony_ci 1267e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or **streamUsage** is invalid. 1268e41f4b71Sopenharmony_ci 1269e41f4b71Sopenharmony_ci 1270e41f4b71Sopenharmony_ci### OH_AVPlayer_SetDecryptionConfig() 1271e41f4b71Sopenharmony_ci 1272e41f4b71Sopenharmony_ci``` 1273e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetDecryptionConfig (OH_AVPlayer *player, MediaKeySession *mediaKeySession, bool secureVideoPath) 1274e41f4b71Sopenharmony_ci``` 1275e41f4b71Sopenharmony_ci 1276e41f4b71Sopenharmony_ci**Description** 1277e41f4b71Sopenharmony_ci 1278e41f4b71Sopenharmony_ciSets the decryption information. 1279e41f4b71Sopenharmony_ci 1280e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1281e41f4b71Sopenharmony_ci 1282e41f4b71Sopenharmony_ci**Since**: 12 1283e41f4b71Sopenharmony_ci 1284e41f4b71Sopenharmony_ci**Parameters** 1285e41f4b71Sopenharmony_ci 1286e41f4b71Sopenharmony_ci| Name| Description| 1287e41f4b71Sopenharmony_ci| -------- | -------- | 1288e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1289e41f4b71Sopenharmony_ci| mediaKeySession | Pointer to the media key session with the decryption feature.| 1290e41f4b71Sopenharmony_ci| secureVideoPath | Whether a secure decoder is required.| 1291e41f4b71Sopenharmony_ci 1292e41f4b71Sopenharmony_ci**Returns** 1293e41f4b71Sopenharmony_ci 1294e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1295e41f4b71Sopenharmony_ci 1296e41f4b71Sopenharmony_ci**AV_ERR_OK**: The setting is successful. 1297e41f4b71Sopenharmony_ci 1298e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SetDecryptionConfig** fails. 1299e41f4b71Sopenharmony_ci 1300e41f4b71Sopenharmony_ci 1301e41f4b71Sopenharmony_ci### OH_AVPlayer_SetFDSource() 1302e41f4b71Sopenharmony_ci 1303e41f4b71Sopenharmony_ci``` 1304e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetFDSource (OH_AVPlayer *player, int32_t fd, int64_t offset, int64_t size) 1305e41f4b71Sopenharmony_ci``` 1306e41f4b71Sopenharmony_ci 1307e41f4b71Sopenharmony_ci**Description** 1308e41f4b71Sopenharmony_ci 1309e41f4b71Sopenharmony_ciSets the file descriptor of a media source to be played by an AVPlayer. 1310e41f4b71Sopenharmony_ci 1311e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1312e41f4b71Sopenharmony_ci 1313e41f4b71Sopenharmony_ci**Since**: 11 1314e41f4b71Sopenharmony_ci 1315e41f4b71Sopenharmony_ci**Parameters** 1316e41f4b71Sopenharmony_ci 1317e41f4b71Sopenharmony_ci| Name| Description| 1318e41f4b71Sopenharmony_ci| -------- | -------- | 1319e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1320e41f4b71Sopenharmony_ci| fd | File descriptor of the media source.| 1321e41f4b71Sopenharmony_ci| offset | Offset of the media source in the file descriptor.| 1322e41f4b71Sopenharmony_ci| size | Size of the media source.| 1323e41f4b71Sopenharmony_ci 1324e41f4b71Sopenharmony_ci**Returns** 1325e41f4b71Sopenharmony_ci 1326e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1327e41f4b71Sopenharmony_ci 1328e41f4b71Sopenharmony_ci**AV_ERR_OK**: The file descriptor is set. 1329e41f4b71Sopenharmony_ci 1330e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SetFdSource** fails. 1331e41f4b71Sopenharmony_ci 1332e41f4b71Sopenharmony_ci 1333e41f4b71Sopenharmony_ci### OH_AVPlayer_SetLooping() 1334e41f4b71Sopenharmony_ci 1335e41f4b71Sopenharmony_ci``` 1336e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetLooping (OH_AVPlayer *player, bool loop) 1337e41f4b71Sopenharmony_ci``` 1338e41f4b71Sopenharmony_ci 1339e41f4b71Sopenharmony_ci**Description** 1340e41f4b71Sopenharmony_ci 1341e41f4b71Sopenharmony_ciEnables loop playback. 1342e41f4b71Sopenharmony_ci 1343e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1344e41f4b71Sopenharmony_ci 1345e41f4b71Sopenharmony_ci**Since**: 11 1346e41f4b71Sopenharmony_ci 1347e41f4b71Sopenharmony_ci**Parameters** 1348e41f4b71Sopenharmony_ci 1349e41f4b71Sopenharmony_ci| Name| Description| 1350e41f4b71Sopenharmony_ci| -------- | -------- | 1351e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1352e41f4b71Sopenharmony_ci| loop | Whether to enable loop playback.| 1353e41f4b71Sopenharmony_ci 1354e41f4b71Sopenharmony_ci**Returns** 1355e41f4b71Sopenharmony_ci 1356e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1357e41f4b71Sopenharmony_ci 1358e41f4b71Sopenharmony_ci**AV_ERR_OK**: Loop playback is enabled. 1359e41f4b71Sopenharmony_ci 1360e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SetLooping** fails. 1361e41f4b71Sopenharmony_ci 1362e41f4b71Sopenharmony_ci 1363e41f4b71Sopenharmony_ci### OH_AVPlayer_SetMediaKeySystemInfoCallback() 1364e41f4b71Sopenharmony_ci 1365e41f4b71Sopenharmony_ci``` 1366e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetMediaKeySystemInfoCallback (OH_AVPlayer *player, Player_MediaKeySystemInfoCallback callback) 1367e41f4b71Sopenharmony_ci``` 1368e41f4b71Sopenharmony_ci 1369e41f4b71Sopenharmony_ci**Description** 1370e41f4b71Sopenharmony_ci 1371e41f4b71Sopenharmony_ciSets a callback to return the media key system information for an AVPlayer. 1372e41f4b71Sopenharmony_ci 1373e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1374e41f4b71Sopenharmony_ci 1375e41f4b71Sopenharmony_ci**Since**: 12 1376e41f4b71Sopenharmony_ci 1377e41f4b71Sopenharmony_ci**Parameters** 1378e41f4b71Sopenharmony_ci 1379e41f4b71Sopenharmony_ci| Name| Description| 1380e41f4b71Sopenharmony_ci| -------- | -------- | 1381e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1382e41f4b71Sopenharmony_ci| callback | Callback.| 1383e41f4b71Sopenharmony_ci 1384e41f4b71Sopenharmony_ci**Returns** 1385e41f4b71Sopenharmony_ci 1386e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1387e41f4b71Sopenharmony_ci 1388e41f4b71Sopenharmony_ci**AV_ERR_OK**: The setting is successful. 1389e41f4b71Sopenharmony_ci 1390e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, the input parameter **callback** is null, or the execution of **player SetDrmSystemInfoCallback** fails. 1391e41f4b71Sopenharmony_ci 1392e41f4b71Sopenharmony_ci 1393e41f4b71Sopenharmony_ci### OH_AVPlayer_SetOnErrorCallback() 1394e41f4b71Sopenharmony_ci 1395e41f4b71Sopenharmony_ci``` 1396e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetOnErrorCallback (OH_AVPlayer * player, OH_AVPlayerOnErrorCallback callback, void * userData ) 1397e41f4b71Sopenharmony_ci``` 1398e41f4b71Sopenharmony_ci 1399e41f4b71Sopenharmony_ci**Description** 1400e41f4b71Sopenharmony_ci 1401e41f4b71Sopenharmony_ciSets a callback for the event indicating that an error occurs in the AVPlayer. 1402e41f4b71Sopenharmony_ci 1403e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1404e41f4b71Sopenharmony_ci 1405e41f4b71Sopenharmony_ci**Since**: 12 1406e41f4b71Sopenharmony_ci 1407e41f4b71Sopenharmony_ci**Parameters** 1408e41f4b71Sopenharmony_ci 1409e41f4b71Sopenharmony_ci| Name| Description| 1410e41f4b71Sopenharmony_ci| -------- | -------- | 1411e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance. | 1412e41f4b71Sopenharmony_ci| callback | Pointer to the callback. If a null pointer is passed in, the listening for AVPlayer errors is canceled. | 1413e41f4b71Sopenharmony_ci| userData | Pointer to the instance set by the caller. | 1414e41f4b71Sopenharmony_ci 1415e41f4b71Sopenharmony_ci**Returns** 1416e41f4b71Sopenharmony_ci 1417e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1418e41f4b71Sopenharmony_ci 1419e41f4b71Sopenharmony_ci**AV_ERR_OK**: The operation is successful. 1420e41f4b71Sopenharmony_ci 1421e41f4b71Sopenharmony_ci**AV_ERR_NO_MEMORY**: An error occurs during memory allocation. 1422e41f4b71Sopenharmony_ci 1423e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or the function fails to be executed. 1424e41f4b71Sopenharmony_ci 1425e41f4b71Sopenharmony_ci 1426e41f4b71Sopenharmony_ci### OH_AVPlayer_SetOnInfoCallback() 1427e41f4b71Sopenharmony_ci 1428e41f4b71Sopenharmony_ci``` 1429e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetOnInfoCallback (OH_AVPlayer * player, OH_AVPlayerOnInfoCallback callback, void * userData ) 1430e41f4b71Sopenharmony_ci``` 1431e41f4b71Sopenharmony_ci 1432e41f4b71Sopenharmony_ci**Description** 1433e41f4b71Sopenharmony_ci 1434e41f4b71Sopenharmony_ciSets a callback for the event indicating that the AVPlayer receives a message. 1435e41f4b71Sopenharmony_ci 1436e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1437e41f4b71Sopenharmony_ci 1438e41f4b71Sopenharmony_ci**Since**: 12 1439e41f4b71Sopenharmony_ci 1440e41f4b71Sopenharmony_ci**Parameters** 1441e41f4b71Sopenharmony_ci 1442e41f4b71Sopenharmony_ci| Name| Description| 1443e41f4b71Sopenharmony_ci| -------- | -------- | 1444e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance. | 1445e41f4b71Sopenharmony_ci| callback | Pointer to the callback. If a null pointer is passed in, the listening for AVPlayer messages is canceled. | 1446e41f4b71Sopenharmony_ci| userData | Pointer to the instance set by the caller. | 1447e41f4b71Sopenharmony_ci 1448e41f4b71Sopenharmony_ci**Returns** 1449e41f4b71Sopenharmony_ci 1450e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1451e41f4b71Sopenharmony_ci 1452e41f4b71Sopenharmony_ci**AV_ERR_OK**: The operation is successful. 1453e41f4b71Sopenharmony_ci 1454e41f4b71Sopenharmony_ci**AV_ERR_NO_MEMORY**: An error occurs during memory allocation. 1455e41f4b71Sopenharmony_ci 1456e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or the function fails to be executed. 1457e41f4b71Sopenharmony_ci 1458e41f4b71Sopenharmony_ci 1459e41f4b71Sopenharmony_ci### OH_AVPlayer_SetPlaybackSpeed() 1460e41f4b71Sopenharmony_ci 1461e41f4b71Sopenharmony_ci``` 1462e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetPlaybackSpeed (OH_AVPlayer *player, AVPlaybackSpeed speed) 1463e41f4b71Sopenharmony_ci``` 1464e41f4b71Sopenharmony_ci 1465e41f4b71Sopenharmony_ci**Description** 1466e41f4b71Sopenharmony_ci 1467e41f4b71Sopenharmony_ciSets the playback speed for an AVPlayer. 1468e41f4b71Sopenharmony_ci 1469e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1470e41f4b71Sopenharmony_ci 1471e41f4b71Sopenharmony_ci**Parameters** 1472e41f4b71Sopenharmony_ci 1473e41f4b71Sopenharmony_ci| Name| Description| 1474e41f4b71Sopenharmony_ci| -------- | -------- | 1475e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1476e41f4b71Sopenharmony_ci| speed | Playback speed. For details about the available options, see [AVPlaybackSpeed](#avplaybackspeed).| 1477e41f4b71Sopenharmony_ci 1478e41f4b71Sopenharmony_ci**Returns** 1479e41f4b71Sopenharmony_ci 1480e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1481e41f4b71Sopenharmony_ci 1482e41f4b71Sopenharmony_ci**AV_ERR_OK**: The playback speed is set. 1483e41f4b71Sopenharmony_ci 1484e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer. 1485e41f4b71Sopenharmony_ci 1486e41f4b71Sopenharmony_ci 1487e41f4b71Sopenharmony_ci### OH_AVPlayer_SetPlayerCallback() 1488e41f4b71Sopenharmony_ci 1489e41f4b71Sopenharmony_ci``` 1490e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetPlayerCallback (OH_AVPlayer *player, AVPlayerCallback callback) 1491e41f4b71Sopenharmony_ci``` 1492e41f4b71Sopenharmony_ci 1493e41f4b71Sopenharmony_ci**Description** 1494e41f4b71Sopenharmony_ciSets an AVPlayer callback. 1495e41f4b71Sopenharmony_ci 1496e41f4b71Sopenharmony_ciThe callbacks [OH_AVPlayerOnInfo](#oh_avplayeroninfo) and [OH_AVPlayerOnError](#oh_avplayeronerror) set by using this function can transfer limited information. In addition, it is inconvenient for the application to distinguish between multiple **AVPlayer** instances. Therefore, since API version 12, [OH_AVPlayer_SetOnInfoCallback()](#oh_avplayer_setoninfocallback) and [OH_AVPlayer_SetOnErrorCallback()](#oh_avplayer_setonerrorcallback) are provided to set the callbacks [OH_AVPlayerOnInfoCallback](../../reference/apis-media-kit/_a_v_player.md#oh_avplayeroninfocallback) and [OH_AVPlayerOnErrorCallback](../../reference/apis-media-kit/_a_v_player.md#oh_avplayeronerrorcallback), respectively. 1497e41f4b71Sopenharmony_ci 1498e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1499e41f4b71Sopenharmony_ci 1500e41f4b71Sopenharmony_ci**Since**: 11 1501e41f4b71Sopenharmony_ci 1502e41f4b71Sopenharmony_ci**Parameters** 1503e41f4b71Sopenharmony_ci 1504e41f4b71Sopenharmony_ci| Name| Description| 1505e41f4b71Sopenharmony_ci| -------- | -------- | 1506e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1507e41f4b71Sopenharmony_ci| callback | Callback used to return the result.| 1508e41f4b71Sopenharmony_ci 1509e41f4b71Sopenharmony_ci**Returns** 1510e41f4b71Sopenharmony_ci 1511e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1512e41f4b71Sopenharmony_ci 1513e41f4b71Sopenharmony_ci**AV_ERR_OK**: The callback is set. 1514e41f4b71Sopenharmony_ci 1515e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, the input parameter **callback.onInfo** or **onError** is null, or the execution of **player SetPlayerCallback** fails. 1516e41f4b71Sopenharmony_ci 1517e41f4b71Sopenharmony_ci 1518e41f4b71Sopenharmony_ci### OH_AVPlayer_SetURLSource() 1519e41f4b71Sopenharmony_ci 1520e41f4b71Sopenharmony_ci``` 1521e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetURLSource (OH_AVPlayer *player, const char *url) 1522e41f4b71Sopenharmony_ci``` 1523e41f4b71Sopenharmony_ci 1524e41f4b71Sopenharmony_ci**Description** 1525e41f4b71Sopenharmony_ci 1526e41f4b71Sopenharmony_ciSets the HTTP URL of a media source to be played by an AVPlayer. 1527e41f4b71Sopenharmony_ci 1528e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1529e41f4b71Sopenharmony_ci 1530e41f4b71Sopenharmony_ci**Since**: 11 1531e41f4b71Sopenharmony_ci 1532e41f4b71Sopenharmony_ci**Parameters** 1533e41f4b71Sopenharmony_ci 1534e41f4b71Sopenharmony_ci| Name| Description| 1535e41f4b71Sopenharmony_ci| -------- | -------- | 1536e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1537e41f4b71Sopenharmony_ci| url | URL of the media source.| 1538e41f4b71Sopenharmony_ci 1539e41f4b71Sopenharmony_ci**Returns** 1540e41f4b71Sopenharmony_ci 1541e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1542e41f4b71Sopenharmony_ci 1543e41f4b71Sopenharmony_ci**AV_ERR_OK**: The setting is successful. 1544e41f4b71Sopenharmony_ci 1545e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, the input parameter **url** is null, or the execution of **player SetUrlSource** fails. 1546e41f4b71Sopenharmony_ci 1547e41f4b71Sopenharmony_ci 1548e41f4b71Sopenharmony_ci### OH_AVPlayer_SetVideoSurface() 1549e41f4b71Sopenharmony_ci 1550e41f4b71Sopenharmony_ci``` 1551e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetVideoSurface (OH_AVPlayer *player, OHNativeWindow *window) 1552e41f4b71Sopenharmony_ci``` 1553e41f4b71Sopenharmony_ci 1554e41f4b71Sopenharmony_ci**Description** 1555e41f4b71Sopenharmony_ci 1556e41f4b71Sopenharmony_ciSets a playback window. 1557e41f4b71Sopenharmony_ciThis function must be called after **SetSource** and before **Prepare**. 1558e41f4b71Sopenharmony_ci 1559e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1560e41f4b71Sopenharmony_ci 1561e41f4b71Sopenharmony_ci**Parameters** 1562e41f4b71Sopenharmony_ci 1563e41f4b71Sopenharmony_ci| Name| Description| 1564e41f4b71Sopenharmony_ci| -------- | -------- | 1565e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1566e41f4b71Sopenharmony_ci| window | Pointer to an **OHNativeWindow** instance.| 1567e41f4b71Sopenharmony_ci 1568e41f4b71Sopenharmony_ci**Returns** 1569e41f4b71Sopenharmony_ci 1570e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1571e41f4b71Sopenharmony_ci 1572e41f4b71Sopenharmony_ciAV_ERR_OK: The playback window is set. 1573e41f4b71Sopenharmony_ci 1574e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** or **window** is a null pointer, or the execution of **player SetVideoSurface** fails. 1575e41f4b71Sopenharmony_ci 1576e41f4b71Sopenharmony_ci 1577e41f4b71Sopenharmony_ci### OH_AVPlayer_SetVolume() 1578e41f4b71Sopenharmony_ci 1579e41f4b71Sopenharmony_ci``` 1580e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_SetVolume (OH_AVPlayer *player, float leftVolume, float rightVolume) 1581e41f4b71Sopenharmony_ci``` 1582e41f4b71Sopenharmony_ci 1583e41f4b71Sopenharmony_ci**Description** 1584e41f4b71Sopenharmony_ci 1585e41f4b71Sopenharmony_ciSets the volume for an AVPlayer. 1586e41f4b71Sopenharmony_ci 1587e41f4b71Sopenharmony_ciThis function can be used when the AVPlayer is in the playing or paused state. The value **0** means that the AVPlayer is muted, and **1** means that the original volume is used. 1588e41f4b71Sopenharmony_ci 1589e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1590e41f4b71Sopenharmony_ci 1591e41f4b71Sopenharmony_ci**Since**: 11 1592e41f4b71Sopenharmony_ci 1593e41f4b71Sopenharmony_ci**Parameters** 1594e41f4b71Sopenharmony_ci 1595e41f4b71Sopenharmony_ci| Name| Description| 1596e41f4b71Sopenharmony_ci| -------- | -------- | 1597e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1598e41f4b71Sopenharmony_ci| leftVolume | Target volume of the left channel.| 1599e41f4b71Sopenharmony_ci| rightVolume | Target volume of the right channel.| 1600e41f4b71Sopenharmony_ci 1601e41f4b71Sopenharmony_ci**Returns** 1602e41f4b71Sopenharmony_ci 1603e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1604e41f4b71Sopenharmony_ci 1605e41f4b71Sopenharmony_ciAV_ERR_OK: The volume is set. 1606e41f4b71Sopenharmony_ci 1607e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SetVolume** fails. 1608e41f4b71Sopenharmony_ci 1609e41f4b71Sopenharmony_ci 1610e41f4b71Sopenharmony_ci### OH_AVPlayer_Stop() 1611e41f4b71Sopenharmony_ci 1612e41f4b71Sopenharmony_ci``` 1613e41f4b71Sopenharmony_ciOH_AVErrCode OH_AVPlayer_Stop (OH_AVPlayer *player) 1614e41f4b71Sopenharmony_ci``` 1615e41f4b71Sopenharmony_ci 1616e41f4b71Sopenharmony_ci**Description** 1617e41f4b71Sopenharmony_ci 1618e41f4b71Sopenharmony_ciStops playback. 1619e41f4b71Sopenharmony_ci 1620e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1621e41f4b71Sopenharmony_ci 1622e41f4b71Sopenharmony_ci**Since**: 11 1623e41f4b71Sopenharmony_ci 1624e41f4b71Sopenharmony_ci**Parameters** 1625e41f4b71Sopenharmony_ci 1626e41f4b71Sopenharmony_ci| Name| Description| 1627e41f4b71Sopenharmony_ci| -------- | -------- | 1628e41f4b71Sopenharmony_ci| player | Pointer to an **OH_AVPlayer** instance.| 1629e41f4b71Sopenharmony_ci 1630e41f4b71Sopenharmony_ci**Returns** 1631e41f4b71Sopenharmony_ci 1632e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1633e41f4b71Sopenharmony_ci 1634e41f4b71Sopenharmony_ci**AV_ERR_OK**: The **stop** operation is added to the task queue. 1635e41f4b71Sopenharmony_ci 1636e41f4b71Sopenharmony_ci**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Stop** fails. 1637e41f4b71Sopenharmony_ci 1638e41f4b71Sopenharmony_ci 1639e41f4b71Sopenharmony_ci## Variable Description 1640e41f4b71Sopenharmony_ci 1641e41f4b71Sopenharmony_ci 1642e41f4b71Sopenharmony_ci### OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON 1643e41f4b71Sopenharmony_ci 1644e41f4b71Sopenharmony_ci``` 1645e41f4b71Sopenharmony_ciconst char* OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON 1646e41f4b71Sopenharmony_ci``` 1647e41f4b71Sopenharmony_ci**Description** 1648e41f4b71Sopenharmony_ci 1649e41f4b71Sopenharmony_ciPointer to the key for obtaining the audio device change reason. The value is of the int32_t type. 1650e41f4b71Sopenharmony_ci 1651e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1652e41f4b71Sopenharmony_ci 1653e41f4b71Sopenharmony_ci**Since**: 12 1654e41f4b71Sopenharmony_ci 1655e41f4b71Sopenharmony_ci 1656e41f4b71Sopenharmony_ci### OH_PLAYER_AUDIO_INTERRUPT_FORCE 1657e41f4b71Sopenharmony_ci 1658e41f4b71Sopenharmony_ci``` 1659e41f4b71Sopenharmony_ciconst char* OH_PLAYER_AUDIO_INTERRUPT_FORCE 1660e41f4b71Sopenharmony_ci``` 1661e41f4b71Sopenharmony_ci 1662e41f4b71Sopenharmony_ci**Description** 1663e41f4b71Sopenharmony_ci 1664e41f4b71Sopenharmony_ciPointer to the key for obtaining the FORCE type of audio interruption. The value is of the int32_t type. 1665e41f4b71Sopenharmony_ci 1666e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1667e41f4b71Sopenharmony_ci 1668e41f4b71Sopenharmony_ci**Since**: 12 1669e41f4b71Sopenharmony_ci 1670e41f4b71Sopenharmony_ci 1671e41f4b71Sopenharmony_ci### OH_PLAYER_AUDIO_INTERRUPT_HINT 1672e41f4b71Sopenharmony_ci 1673e41f4b71Sopenharmony_ci``` 1674e41f4b71Sopenharmony_ciconst char* OH_PLAYER_AUDIO_INTERRUPT_HINT 1675e41f4b71Sopenharmony_ci``` 1676e41f4b71Sopenharmony_ci 1677e41f4b71Sopenharmony_ci**Description** 1678e41f4b71Sopenharmony_ci 1679e41f4b71Sopenharmony_ciPointer to the key for obtaining the HINT type of audio interruption. The value is of the int32_t type. 1680e41f4b71Sopenharmony_ci 1681e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1682e41f4b71Sopenharmony_ci 1683e41f4b71Sopenharmony_ci**Since**: 12 1684e41f4b71Sopenharmony_ci 1685e41f4b71Sopenharmony_ci 1686e41f4b71Sopenharmony_ci### OH_PLAYER_AUDIO_INTERRUPT_TYPE 1687e41f4b71Sopenharmony_ci 1688e41f4b71Sopenharmony_ci``` 1689e41f4b71Sopenharmony_ciconst char* OH_PLAYER_AUDIO_INTERRUPT_TYPE 1690e41f4b71Sopenharmony_ci``` 1691e41f4b71Sopenharmony_ci 1692e41f4b71Sopenharmony_ci**Description** 1693e41f4b71Sopenharmony_ci 1694e41f4b71Sopenharmony_ciPointer to the key for obtaining the audio interruption type. The value is of the int32_t type. 1695e41f4b71Sopenharmony_ci 1696e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1697e41f4b71Sopenharmony_ci 1698e41f4b71Sopenharmony_ci**Since**: 12 1699e41f4b71Sopenharmony_ci 1700e41f4b71Sopenharmony_ci 1701e41f4b71Sopenharmony_ci### OH_PLAYER_BITRATE 1702e41f4b71Sopenharmony_ci 1703e41f4b71Sopenharmony_ci``` 1704e41f4b71Sopenharmony_ciconst char* OH_PLAYER_BITRATE 1705e41f4b71Sopenharmony_ci``` 1706e41f4b71Sopenharmony_ci 1707e41f4b71Sopenharmony_ci**Description** 1708e41f4b71Sopenharmony_ci 1709e41f4b71Sopenharmony_ciPointer to the key for obtaining the bit rate. The value is of the int32_t type. 1710e41f4b71Sopenharmony_ci 1711e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1712e41f4b71Sopenharmony_ci 1713e41f4b71Sopenharmony_ci**Since**: 12 1714e41f4b71Sopenharmony_ci 1715e41f4b71Sopenharmony_ci 1716e41f4b71Sopenharmony_ci### OH_PLAYER_BITRATE_ARRAY 1717e41f4b71Sopenharmony_ci 1718e41f4b71Sopenharmony_ci``` 1719e41f4b71Sopenharmony_ciconst char* OH_PLAYER_BITRATE_ARRAY 1720e41f4b71Sopenharmony_ci``` 1721e41f4b71Sopenharmony_ci 1722e41f4b71Sopenharmony_ci**Description** 1723e41f4b71Sopenharmony_ci 1724e41f4b71Sopenharmony_ciPointer to the key for obtaining the bit rate array. The value is of the uint8_t byte array type. When this key is used to obtain information, you need to: 1725e41f4b71Sopenharmony_ci- Use a pointer variable of the uint8_t type to store the bit rate list and use a variable of the size_t type to store the byte array length. 1726e41f4b71Sopenharmony_ci- Allocate several storage spaces of the uint32_t type to receive the bit rate integer of the uint32_t type, which is converted from the uint8_t byte array. For details, see the **OHAVPlayerOnInfoCallback** function in [Sample Code](../../media/media/using-ndk-avplayer-for-playerback.md#sample-code). 1727e41f4b71Sopenharmony_ci 1728e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1729e41f4b71Sopenharmony_ci 1730e41f4b71Sopenharmony_ci**Since**: 12 1731e41f4b71Sopenharmony_ci 1732e41f4b71Sopenharmony_ci 1733e41f4b71Sopenharmony_ci### OH_PLAYER_BUFFERING_TYPE 1734e41f4b71Sopenharmony_ci 1735e41f4b71Sopenharmony_ci``` 1736e41f4b71Sopenharmony_ciconst char* OH_PLAYER_BUFFERING_TYPE 1737e41f4b71Sopenharmony_ci``` 1738e41f4b71Sopenharmony_ci 1739e41f4b71Sopenharmony_ci**Description** 1740e41f4b71Sopenharmony_ci 1741e41f4b71Sopenharmony_ciPointer to the key for obtaining the type of the buffer update message. The value type is [AVPlayerBufferingType](#avplayerbufferingtype-1). When this key is used to obtain information, you must use a variable of the int32_t type to save the result and then convert the result to a value of [AVPlayerBufferingType](#avplayerbufferingtype-1). 1742e41f4b71Sopenharmony_ci 1743e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1744e41f4b71Sopenharmony_ci 1745e41f4b71Sopenharmony_ci**Since**: 12 1746e41f4b71Sopenharmony_ci 1747e41f4b71Sopenharmony_ci 1748e41f4b71Sopenharmony_ci### OH_PLAYER_BUFFERING_VALUE 1749e41f4b71Sopenharmony_ci 1750e41f4b71Sopenharmony_ci``` 1751e41f4b71Sopenharmony_ciconst char* OH_PLAYER_BUFFERING_VALUE 1752e41f4b71Sopenharmony_ci``` 1753e41f4b71Sopenharmony_ci 1754e41f4b71Sopenharmony_ci**Description** 1755e41f4b71Sopenharmony_ci 1756e41f4b71Sopenharmony_ciPointer to the key for obtaining the value of the buffer update message. The value is of the int32_t type. For details about the available options, see [AVPlayerBufferingType](#avplayerbufferingtype-1). This key is valid when the buffer update message type is **AVPLAYER_BUFFERING_PERCENT** or **AVPLAYER_BUFFERING_CACHED_DURATION**. 1757e41f4b71Sopenharmony_ci 1758e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1759e41f4b71Sopenharmony_ci 1760e41f4b71Sopenharmony_ci**Since**: 12 1761e41f4b71Sopenharmony_ci 1762e41f4b71Sopenharmony_ci 1763e41f4b71Sopenharmony_ci### OH_PLAYER_CURRENT_POSITION 1764e41f4b71Sopenharmony_ci 1765e41f4b71Sopenharmony_ci``` 1766e41f4b71Sopenharmony_ciconst char* OH_PLAYER_CURRENT_POSITION 1767e41f4b71Sopenharmony_ci``` 1768e41f4b71Sopenharmony_ci 1769e41f4b71Sopenharmony_ci**Description** 1770e41f4b71Sopenharmony_ci 1771e41f4b71Sopenharmony_ciPointer to the key for obtaining the playback progress information. The value is of the int32_t type. 1772e41f4b71Sopenharmony_ci 1773e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1774e41f4b71Sopenharmony_ci 1775e41f4b71Sopenharmony_ci**Since**: 12 1776e41f4b71Sopenharmony_ci 1777e41f4b71Sopenharmony_ci 1778e41f4b71Sopenharmony_ci### OH_PLAYER_DURATION 1779e41f4b71Sopenharmony_ci 1780e41f4b71Sopenharmony_ci``` 1781e41f4b71Sopenharmony_ciconst char* OH_PLAYER_DURATION 1782e41f4b71Sopenharmony_ci``` 1783e41f4b71Sopenharmony_ci 1784e41f4b71Sopenharmony_ci**Description** 1785e41f4b71Sopenharmony_ci 1786e41f4b71Sopenharmony_ciPointer to the key for obtaining the media asset duration. The value type is int64_t. 1787e41f4b71Sopenharmony_ci 1788e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1789e41f4b71Sopenharmony_ci 1790e41f4b71Sopenharmony_ci**Since**: 12 1791e41f4b71Sopenharmony_ci 1792e41f4b71Sopenharmony_ci 1793e41f4b71Sopenharmony_ci### OH_PLAYER_IS_LIVE_STREAM 1794e41f4b71Sopenharmony_ci 1795e41f4b71Sopenharmony_ci``` 1796e41f4b71Sopenharmony_ciconst char* OH_PLAYER_IS_LIVE_STREAM 1797e41f4b71Sopenharmony_ci``` 1798e41f4b71Sopenharmony_ci 1799e41f4b71Sopenharmony_ci**Description** 1800e41f4b71Sopenharmony_ci 1801e41f4b71Sopenharmony_ciPointer to the key for checking whether a media asset is live streaming. The value is of the int32_t type. 1802e41f4b71Sopenharmony_ci 1803e41f4b71Sopenharmony_ciThe value **1** means live streaming. 1804e41f4b71Sopenharmony_ci 1805e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1806e41f4b71Sopenharmony_ci 1807e41f4b71Sopenharmony_ci**Since**: 12 1808e41f4b71Sopenharmony_ci 1809e41f4b71Sopenharmony_ci 1810e41f4b71Sopenharmony_ci### OH_PLAYER_MESSAGE_TYPE 1811e41f4b71Sopenharmony_ci 1812e41f4b71Sopenharmony_ci``` 1813e41f4b71Sopenharmony_ciconst char* OH_PLAYER_MESSAGE_TYPE 1814e41f4b71Sopenharmony_ci``` 1815e41f4b71Sopenharmony_ci 1816e41f4b71Sopenharmony_ci**Description** 1817e41f4b71Sopenharmony_ci 1818e41f4b71Sopenharmony_ciPointer to the key for obtaining the type of message received by the AVPlayer. The value is of the int32_t type. 1819e41f4b71Sopenharmony_ci 1820e41f4b71Sopenharmony_ciThe value **1** means that the video frame starts to be rendered. 1821e41f4b71Sopenharmony_ci 1822e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1823e41f4b71Sopenharmony_ci 1824e41f4b71Sopenharmony_ci**Since**: 12 1825e41f4b71Sopenharmony_ci 1826e41f4b71Sopenharmony_ci 1827e41f4b71Sopenharmony_ci### OH_PLAYER_PLAYBACK_SPEED 1828e41f4b71Sopenharmony_ci 1829e41f4b71Sopenharmony_ci``` 1830e41f4b71Sopenharmony_ciconst char* OH_PLAYER_PLAYBACK_SPEED 1831e41f4b71Sopenharmony_ci``` 1832e41f4b71Sopenharmony_ci 1833e41f4b71Sopenharmony_ci**Description** 1834e41f4b71Sopenharmony_ci 1835e41f4b71Sopenharmony_ciPointer to the key for obtaining the playback speed. The value type is [AVPlaybackSpeed](#avplaybackspeed-1). When this key is used to obtain information, you must use a variable of the int32_t type to save the result and then convert the result to a value of [AVPlaybackSpeed](#avplaybackspeed-1). 1836e41f4b71Sopenharmony_ci 1837e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1838e41f4b71Sopenharmony_ci 1839e41f4b71Sopenharmony_ci**Since**: 12 1840e41f4b71Sopenharmony_ci 1841e41f4b71Sopenharmony_ci 1842e41f4b71Sopenharmony_ci### OH_PLAYER_SEEK_POSITION 1843e41f4b71Sopenharmony_ci 1844e41f4b71Sopenharmony_ci``` 1845e41f4b71Sopenharmony_ciconst char* OH_PLAYER_SEEK_POSITION 1846e41f4b71Sopenharmony_ci``` 1847e41f4b71Sopenharmony_ci 1848e41f4b71Sopenharmony_ci**Description** 1849e41f4b71Sopenharmony_ci 1850e41f4b71Sopenharmony_ciPointer to the key for obtaining the playback progress after the seek operation. The value is of the int32_t type. 1851e41f4b71Sopenharmony_ci 1852e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1853e41f4b71Sopenharmony_ci 1854e41f4b71Sopenharmony_ci**Since**: 12 1855e41f4b71Sopenharmony_ci 1856e41f4b71Sopenharmony_ci 1857e41f4b71Sopenharmony_ci### OH_PLAYER_STATE 1858e41f4b71Sopenharmony_ci 1859e41f4b71Sopenharmony_ci``` 1860e41f4b71Sopenharmony_ciconst char* OH_PLAYER_STATE 1861e41f4b71Sopenharmony_ci``` 1862e41f4b71Sopenharmony_ci 1863e41f4b71Sopenharmony_ci**Description** 1864e41f4b71Sopenharmony_ci 1865e41f4b71Sopenharmony_ciPointer to the key for obtaining the AVPlayer state. The value is of the int32_t type. 1866e41f4b71Sopenharmony_ci 1867e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1868e41f4b71Sopenharmony_ci 1869e41f4b71Sopenharmony_ci**Since**: 12 1870e41f4b71Sopenharmony_ci 1871e41f4b71Sopenharmony_ci 1872e41f4b71Sopenharmony_ci### OH_PLAYER_STATE_CHANGE_REASON 1873e41f4b71Sopenharmony_ci 1874e41f4b71Sopenharmony_ci``` 1875e41f4b71Sopenharmony_ciconst char* OH_PLAYER_STATE_CHANGE_REASON 1876e41f4b71Sopenharmony_ci``` 1877e41f4b71Sopenharmony_ci 1878e41f4b71Sopenharmony_ci**Description** 1879e41f4b71Sopenharmony_ci 1880e41f4b71Sopenharmony_ciPointer to the key for obtaining the AVPlayer state change reason. The value is of the int32_t type. 1881e41f4b71Sopenharmony_ci 1882e41f4b71Sopenharmony_ciThe value **1** means that the change is triggered by user operations, and **2** means that the change is triggered by the system. 1883e41f4b71Sopenharmony_ci 1884e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1885e41f4b71Sopenharmony_ci 1886e41f4b71Sopenharmony_ci**Since**: 12 1887e41f4b71Sopenharmony_ci 1888e41f4b71Sopenharmony_ci 1889e41f4b71Sopenharmony_ci### OH_PLAYER_VIDEO_HEIGHT 1890e41f4b71Sopenharmony_ci 1891e41f4b71Sopenharmony_ci``` 1892e41f4b71Sopenharmony_ciconst char* OH_PLAYER_VIDEO_HEIGHT 1893e41f4b71Sopenharmony_ci``` 1894e41f4b71Sopenharmony_ci 1895e41f4b71Sopenharmony_ci**Description** 1896e41f4b71Sopenharmony_ci 1897e41f4b71Sopenharmony_ciPointer to the key for obtaining the video height. The value is of the int32_t type. 1898e41f4b71Sopenharmony_ci 1899e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1900e41f4b71Sopenharmony_ci 1901e41f4b71Sopenharmony_ci**Since**: 12 1902e41f4b71Sopenharmony_ci 1903e41f4b71Sopenharmony_ci 1904e41f4b71Sopenharmony_ci### OH_PLAYER_VIDEO_WIDTH 1905e41f4b71Sopenharmony_ci 1906e41f4b71Sopenharmony_ci``` 1907e41f4b71Sopenharmony_ciconst char* OH_PLAYER_VIDEO_WIDTH 1908e41f4b71Sopenharmony_ci``` 1909e41f4b71Sopenharmony_ci 1910e41f4b71Sopenharmony_ci**Description** 1911e41f4b71Sopenharmony_ci 1912e41f4b71Sopenharmony_ciPointer to the key for obtaining the video width. The value is of the int32_t type. 1913e41f4b71Sopenharmony_ci 1914e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1915e41f4b71Sopenharmony_ci 1916e41f4b71Sopenharmony_ci**Since**: 12 1917e41f4b71Sopenharmony_ci 1918e41f4b71Sopenharmony_ci 1919e41f4b71Sopenharmony_ci### OH_PLAYER_VOLUME 1920e41f4b71Sopenharmony_ci 1921e41f4b71Sopenharmony_ci``` 1922e41f4b71Sopenharmony_ciconst char* OH_PLAYER_VOLUME 1923e41f4b71Sopenharmony_ci``` 1924e41f4b71Sopenharmony_ci 1925e41f4b71Sopenharmony_ci**Description** 1926e41f4b71Sopenharmony_ci 1927e41f4b71Sopenharmony_ciPointer to the key for obtaining the volume. The value type is float. 1928e41f4b71Sopenharmony_ci 1929e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVPlayer 1930e41f4b71Sopenharmony_ci 1931e41f4b71Sopenharmony_ci**Since**: 12 1932