1e41f4b71Sopenharmony_ci# avplayer_base.h 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## Overview 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ciThe **avplayer_base.h** file declares the structs and enums of the AVPlayer. 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci**Library**: libavplayer.so 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci**File to include**: <multimedia/player_framework/avplayer_base.h> 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci**Since**: 11 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci**Related module**: [AVPlayer](_a_v_player.md) 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci## Summary 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci### Structs 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci| Name| Description| 23e41f4b71Sopenharmony_ci| -------- | -------- | 24e41f4b71Sopenharmony_ci| struct [AVPlayerCallback](_a_v_player_callback.md) | (Deprecated) Contains 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. | 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci### Types 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci| Name| Description| 30e41f4b71Sopenharmony_ci| -------- | -------- | 31e41f4b71Sopenharmony_ci| typedef enum [AVPlayerState](_a_v_player.md#avplayerstate-1) [AVPlayerState](_a_v_player.md#avplayerstate) | Defines an enum for the AVPlayer states. | 32e41f4b71Sopenharmony_ci| typedef enum [AVPlayerSeekMode](_a_v_player.md#avplayerseekmode-1) [AVPlayerSeekMode](_a_v_player.md#avplayerseekmode) | Defines an enum for the seek modes of the AVPlayer. | 33e41f4b71Sopenharmony_ci| typedef enum [AVPlaybackSpeed](_a_v_player.md#avplaybackspeed-1) [AVPlaybackSpeed](_a_v_player.md#avplaybackspeed) | Defines an enum for the playback speeds of the AVPlayer. | 34e41f4b71Sopenharmony_ci| typedef enum [AVPlayerOnInfoType](_a_v_player.md#avplayeroninfotype-1) [AVPlayerOnInfoType](_a_v_player.md#avplayeroninfotype) | Defines an enum for the types of messages received by the AVPlayer. | 35e41f4b71Sopenharmony_ci| typedef enum [AVPlayerBufferingType](_a_v_player.md#avplayerbufferingtype-1) [AVPlayerBufferingType](_a_v_player.md#avplayerbufferingtype) | Defines the types of buffer messages of the AVPlayer. | 36e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVPlayerOnInfo](_a_v_player.md#oh_avplayeroninfo)) (OH_AVPlayer \*player, [AVPlayerOnInfoType](_a_v_player.md#avplayeroninfotype) type, int32_t extra) | (Deprecated) Defines the callback invoked when the AVPlayer receives a message. | 37e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVPlayerOnInfoCallback](_a_v_player.md#oh_avplayeroninfocallback)) (OH_AVPlayer \*player, [AVPlayerOnInfoType](_a_v_player.md#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. | 38e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVPlayerOnError](_a_v_player.md#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. | 39e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVPlayerOnErrorCallback](_a_v_player.md#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. | 40e41f4b71Sopenharmony_ci| typedef struct [AVPlayerCallback](_a_v_player_callback.md) [AVPlayerCallback](_a_v_player.md#avplayercallback) | Defines all the callback function pointers of an **OH_AVPlayer** instance. | 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci### Enums 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci| Name| Description| 46e41f4b71Sopenharmony_ci| -------- | -------- | 47e41f4b71Sopenharmony_ci| [AVPlayerState](_a_v_player.md#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.| 48e41f4b71Sopenharmony_ci| [AVPlayerSeekMode](_a_v_player.md#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.| 49e41f4b71Sopenharmony_ci| [AVPlaybackSpeed](_a_v_player.md#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. | 50e41f4b71Sopenharmony_ci| [AVPlayerOnInfoType](_a_v_player.md#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.| 51e41f4b71Sopenharmony_ci| [AVPlayerBufferingType](_a_v_player.md#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. | 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci### Variables 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci| Name| Description| 57e41f4b71Sopenharmony_ci| -------- | -------- | 58e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_STATE](_a_v_player.md#oh_player_state) | Pointer to the key for obtaining the AVPlayer state. The value is of the int32_t type. | 59e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_STATE_CHANGE_REASON](_a_v_player.md#oh_player_state_change_reason) | Pointer to the key for obtaining the AVPlayer state change reason. The value is of the int32_t type. | 60e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_VOLUME](_a_v_player.md#oh_player_volume) | Pointer to the key for obtaining the volume. The value type is float. | 61e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_BITRATE_ARRAY](_a_v_player.md#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](_a_v_player.md#avplayeroninfotype-1). | 62e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_AUDIO_INTERRUPT_TYPE](_a_v_player.md#oh_player_audio_interrupt_type) | Pointer to the key for obtaining the audio interruption type. The value is of the int32_t type. | 63e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_AUDIO_INTERRUPT_FORCE](_a_v_player.md#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. | 64e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_AUDIO_INTERRUPT_HINT](_a_v_player.md#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. | 65e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON](_a_v_player.md#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. | 66e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_BUFFERING_TYPE](_a_v_player.md#oh_player_buffering_type) | Pointer to the key for obtaining the type of the buffer update message. The value type is **AVPlayerBufferingType**. | 67e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_BUFFERING_VALUE](_a_v_player.md#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. | 68e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_SEEK_POSITION](_a_v_player.md#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. | 69e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_PLAYBACK_SPEED](_a_v_player.md#oh_player_playback_speed) | Pointer to the key for obtaining the playback speed. The value type is **AVPlaybackSpeed**. | 70e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_BITRATE](_a_v_player.md#oh_player_bitrate) | Pointer to the key for obtaining the bit rate. The value is of the int32_t type. | 71e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_CURRENT_POSITION](_a_v_player.md#oh_player_current_position) | Pointer to the key for obtaining the playback progress information. The value is of the int32_t type. | 72e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_DURATION](_a_v_player.md#oh_player_duration) | Pointer to the key for obtaining the media asset duration. The value type is int64_t. | 73e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_VIDEO_WIDTH](_a_v_player.md#oh_player_video_width) | Pointer to the key for obtaining the video width. The value is of the int32_t type. | 74e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_VIDEO_HEIGHT](_a_v_player.md#oh_player_video_height) | Pointer to the key for obtaining the video height. The value is of the int32_t type. | 75e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_MESSAGE_TYPE](_a_v_player.md#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. | 76e41f4b71Sopenharmony_ci| const char \* [OH_PLAYER_IS_LIVE_STREAM](_a_v_player.md#oh_player_is_live_stream) | Pointer to the key for checking whether a media asset is live TV. The value is of the int32_t type. | 77