harmony 鸿蒙avplayer_base.h

  • 2025-06-12
  • 浏览 (4)

avplayer_base.h

Overview

The avplayer_base.h file declares the structs and enums of the AVPlayer.

Library: libavplayer.so

File to include:

Since: 11

Related module: AVPlayer

Summary

Structs

Name Description
struct AVPlayerCallback (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.

Types

Name Description
typedef enum AVPlayerState AVPlayerState Defines an enum for the AVPlayer states.
typedef enum AVPlayerSeekMode AVPlayerSeekMode Defines an enum for the seek modes of the AVPlayer.
typedef enum AVPlaybackSpeed AVPlaybackSpeed Defines an enum for the playback speeds of the AVPlayer.
typedef enum AVPlayerOnInfoType AVPlayerOnInfoType Defines an enum for the types of messages received by the AVPlayer.
typedef enum AVPlayerBufferingType AVPlayerBufferingType Defines the types of buffer messages of the AVPlayer.
typedef void(* OH_AVPlayerOnInfo) (OH_AVPlayer *player, AVPlayerOnInfoType type, int32_t extra) (Deprecated) Defines the callback invoked when the AVPlayer receives a message.
typedef void(* OH_AVPlayerOnInfoCallback) (OH_AVPlayer *player, 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.
typedef void(* 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.
typedef void(* 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.
typedef struct AVPlayerCallback AVPlayerCallback Defines all the callback function pointers of an OH_AVPlayer instance.

Enums

Name Description
AVPlayerState {
AV_IDLE = 0,
AV_INITIALIZED = 1,
AV_PREPARED = 2,
AV_PLAYING = 3,
AV_PAUSED = 4,
AV_STOPPED = 5,
AV_COMPLETED = 6,
AV_RELEASED = 7,
AV_ERROR = 8
}
Enumerates the AVPlayer states.
AVPlayerSeekMode {
AV_SEEK_NEXT_SYNC = 0,
AV_SEEK_PREVIOUS_SYNC,
AV_SEEK_CLOSEST = 2
}
Enumerates the seek modes of the AVPlayer.
AVPlaybackSpeed {
AV_SPEED_FORWARD_0_75_X,
AV_SPEED_FORWARD_1_00_X,
AV_SPEED_FORWARD_1_25_X,
AV_SPEED_FORWARD_1_75_X,
AV_SPEED_FORWARD_2_00_X,
AV_SPEED_FORWARD_0_50_X,
AV_SPEED_FORWARD_1_50_X
}
Enumerates the playback speeds of the AVPlayer.
AVPlayerOnInfoType {
AV_INFO_TYPE_SEEKDONE = 0,
AV_INFO_TYPE_SPEEDDONE = 1,
AV_INFO_TYPE_BITRATEDONE = 2,
AV_INFO_TYPE_EOS = 3,
AV_INFO_TYPE_STATE_CHANGE = 4,
AV_INFO_TYPE_POSITION_UPDATE = 5,
AV_INFO_TYPE_MESSAGE = 6,
AV_INFO_TYPE_VOLUME_CHANGE = 7,
AV_INFO_TYPE_RESOLUTION_CHANGE = 8,
AV_INFO_TYPE_BUFFERING_UPDATE = 9,
AV_INFO_TYPE_BITRATE_COLLECT = 10,
AV_INFO_TYPE_INTERRUPT_EVENT = 11,
AV_INFO_TYPE_DURATION_UPDATE = 12,
AV_INFO_TYPE_IS_LIVE_STREAM = 13,
AV_INFO_TYPE_TRACKCHANGE = 14,
AV_INFO_TYPE_TRACK_INFO_UPDATE = 15,
AV_INFO_TYPE_SUBTITLE_UPDATE = 16, AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE = 17
}
Enumerates the types of messages received by the AVPlayer.
AVPlayerBufferingType {
AVPLAYER_BUFFERING_START = 1,
AVPLAYER_BUFFERING_END,
AVPLAYER_BUFFERING_PERCENT,
AVPLAYER_BUFFERING_CACHED_DURATION
}
Enumerates the types of buffer messages of the AVPlayer.

Variables

Name Description
const char * OH_PLAYER_STATE Pointer to the key for obtaining the AVPlayer state. The value is of the int32_t type.
const char * OH_PLAYER_STATE_CHANGE_REASON Pointer to the key for obtaining the AVPlayer state change reason. The value is of the int32_t type.
const char * OH_PLAYER_VOLUME Pointer to the key for obtaining the volume. The value type is float.
const char * 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.
const char * OH_PLAYER_AUDIO_INTERRUPT_TYPE Pointer to the key for obtaining the audio interruption type. The value is of the int32_t type.
const char * 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.
const char * 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.
const char * 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.
const char * OH_PLAYER_BUFFERING_TYPE Pointer to the key for obtaining the type of the buffer update message. The value type is AVPlayerBufferingType.
const char * 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.
const char * 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.
const char * OH_PLAYER_PLAYBACK_SPEED Pointer to the key for obtaining the playback speed. The value type is AVPlaybackSpeed.
const char * OH_PLAYER_BITRATE Pointer to the key for obtaining the bit rate. The value is of the int32_t type.
const char * OH_PLAYER_CURRENT_POSITION Pointer to the key for obtaining the playback progress information. The value is of the int32_t type.
const char * OH_PLAYER_DURATION Pointer to the key for obtaining the media asset duration. The value type is int64_t.
const char * OH_PLAYER_VIDEO_WIDTH Pointer to the key for obtaining the video width. The value is of the int32_t type.
const char * OH_PLAYER_VIDEO_HEIGHT Pointer to the key for obtaining the video height. The value is of the int32_t type.
const char * 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.
const char * 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.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Media Kit

harmony 鸿蒙AVImageGenerator

harmony 鸿蒙AVMetadataExtractor

harmony 鸿蒙AVPlayer

harmony 鸿蒙AVPlayerCallback

harmony 鸿蒙AVRecorder

harmony 鸿蒙AVScreenCapture

harmony 鸿蒙OH_AVRecorder_Config

harmony 鸿蒙OH_AVRecorder_EncoderInfo

harmony 鸿蒙OH_AVRecorder_Location

0  赞