harmony 鸿蒙avplayer_base.h

2025-06-12 浏览 (1)

avplayer_base.h

Overview

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

Library: libavplayer.so

File to include: <multimedia/player_framework/avplayer_base.h>

Since: 11

Related module: AVPlayer

Summary

Structs

NameDescription
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

NameDescription
typedef enum AVPlayerState AVPlayerStateDefines an enum for the AVPlayer states.
typedef enum AVPlayerSeekMode AVPlayerSeekModeDefines an enum for the seek modes of the AVPlayer.
typedef enum AVPlaybackSpeed AVPlaybackSpeedDefines an enum for the playback speeds of the AVPlayer.
typedef enum AVPlayerOnInfoType AVPlayerOnInfoTypeDefines an enum for the types of messages received by the AVPlayer.
typedef enum AVPlayerBufferingType AVPlayerBufferingTypeDefines 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 AVPlayerCallbackDefines all the callback function pointers of an OH_AVPlayer instance.

Enums

NameDescription
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

NameDescription
const char * OH_PLAYER_STATEPointer to the key for obtaining the AVPlayer state. The value is of the int32_t type.
const char * OH_PLAYER_STATE_CHANGE_REASONPointer to the key for obtaining the AVPlayer state change reason. The value is of the int32_t type.
const char * OH_PLAYER_VOLUMEPointer to the key for obtaining the volume. The value type is float.
const char * OH_PLAYER_BITRATE_ARRAYPointer 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_TYPEPointer to the key for obtaining the audio interruption type. The value is of the int32_t type.
const char * OH_PLAYER_AUDIO_INTERRUPT_FORCEPointer 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_HINTPointer 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_REASONPointer to the key for obtaining the audio device change reason. The value is of the int32_t type.
const char * OH_PLAYER_BUFFERING_TYPEPointer to the key for obtaining the type of the buffer update message. The value type is AVPlayerBufferingType.
const char * OH_PLAYER_BUFFERING_VALUEPointer 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_POSITIONPointer 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_SPEEDPointer to the key for obtaining the playback speed. The value type is AVPlaybackSpeed.
const char * OH_PLAYER_BITRATEPointer to the key for obtaining the bit rate. The value is of the int32_t type.
const char * OH_PLAYER_CURRENT_POSITIONPointer to the key for obtaining the playback progress information. The value is of the int32_t type.
const char * OH_PLAYER_DURATIONPointer to the key for obtaining the media asset duration. The value type is int64_t.
const char * OH_PLAYER_VIDEO_WIDTHPointer to the key for obtaining the video width. The value is of the int32_t type.
const char * OH_PLAYER_VIDEO_HEIGHTPointer to the key for obtaining the video height. The value is of the int32_t type.
const char * OH_PLAYER_MESSAGE_TYPEPointer 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_STREAMPointer 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

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/X8y8BS