avplayer.h

Overview

The avplayer.h file declares the AVPlayer APIs. You can use the native AVPlayer APIs to play a media asset.

Library: libavplayer.so

Since: 11

Related module: AVPlayer

Summary

Functions

Name Description
*OH_AVPlayer_Create (void) Creates an OH_AVPlayer instance.
OH_AVPlayer_SetURLSource (OH_AVPlayer *player, const char *url) Sets the HTTP URL of a media source to be played by an AVPlayer.
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.
OH_AVPlayer_Prepare (OH_AVPlayer *player) Prepares the playback environment and buffers media data.
OH_AVPlayer_Play (OH_AVPlayer *player) Starts playback.
OH_AVPlayer_Pause (OH_AVPlayer *player) Pauses playback.
OH_AVPlayer_Stop (OH_AVPlayer *player) Stops playback.
OH_AVPlayer_Reset (OH_AVPlayer *player) Restores the AVPlayer to the initial state.
OH_AVPlayer_Release (OH_AVPlayer *player) Asynchronously releases an OH_AVPlayer instance.
OH_AVPlayer_ReleaseSync (OH_AVPlayer *player) Synchronously releases an OH_AVPlayer instance.
OH_AVPlayer_SetVolume (OH_AVPlayer *player, float leftVolume, float rightVolume) Sets the volume for an AVPlayer.
OH_AVPlayer_Seek (OH_AVPlayer *player, int32_t mSeconds, AVPlayerSeekMode mode) Seeks to a playback position.
OH_AVPlayer_GetCurrentTime (OH_AVPlayer *player, int32_t *currentTime) Obtains the playback position, in milliseconds.
OH_AVPlayer_GetVideoWidth (OH_AVPlayer *player, int32_t *videoWidth) Obtains the video width.
OH_AVPlayer_GetVideoHeight (OH_AVPlayer *player, int32_t *videoHeight) Obtains the video height.
OH_AVPlayer_SetPlaybackSpeed (OH_AVPlayer *player, AVPlaybackSpeed speed) Sets the playback speed for an AVPlayer.
OH_AVPlayer_GetPlaybackSpeed (OH_AVPlayer *player, AVPlaybackSpeed *speed) Obtains the playback speed of an AVPlayer.
OH_AVPlayer_SelectBitRate (OH_AVPlayer *player, uint32_t bitRate) Sets the bit rate used by an HLS player.
OH_AVPlayer_SetVideoSurface (OH_AVPlayer *player, OHNativeWindow *window) Sets a playback window.
OH_AVPlayer_GetDuration (OH_AVPlayer *player, int32_t *duration) Obtains the total duration of a media file, in milliseconds.
OH_AVPlayer_GetState (OH_AVPlayer *player, AVPlayerState *state) Obtains the AVPlayer state.
OH_AVPlayer_IsPlaying (OH_AVPlayer *player) Checks whether an AVPlayer is playing.
OH_AVPlayer_IsLooping (OH_AVPlayer *player) Checks whether an AVPlayer is looping.
OH_AVPlayer_SetLooping (OH_AVPlayer *player, bool loop) Enables loop playback.
OH_AVPlayer_SetPlayerCallback (OH_AVPlayer *player, AVPlayerCallback callback) Sets a callback for an AVPlayer.
OH_AVPlayer_SelectTrack (OH_AVPlayer *player, int32_t index) Selects an audio or subtitle track.
OH_AVPlayer_DeselectTrack (OH_AVPlayer *player, int32_t index) Deselects an audio or subtitle track.
OH_AVPlayer_GetCurrentTrack (OH_AVPlayer *player, int32_t trackType, int32_t *index) Obtains the currently valid track.