openharmony 鸿蒙 capi-native-avsession-h

2026-08-25 浏览 (2)

native_avsession.h

Overview

The file declares the AVSession definition, which can be used to set metadata, playback state, and other information.

File to include: <multimedia/av_session/native_avsession.h>

Library: libohavsession.so

System capability: SystemCapability.Multimedia.AVSession.Core

Since: 13

Related module: OHAVSession

Summary

Structs

Nametypedef KeywordDescription
AVSession_PlaybackPositionAVSession_PlaybackPositionDescribes the information related to the playback position.
OH_AVSessionOH_AVSessionDefines a struct for the playback control session object. You can use OH_AVSession_Create to create such an object.

Enums

Nametypedef KeywordDescription
AVSession_TypeAVSession_TypeEnumerates the session types.
AVSession_PlaybackStateAVSession_PlaybackStateEnumerates the media playback states.
AVSession_LoopModeAVSession_LoopModeEnumerates the loop modes of media playback.
AVSession_ControlCommandAVSession_ControlCommandEnumerates the playback control commands.
AVSessionCallback_ResultAVSessionCallback_ResultEnumerates the callback execution results.

Functions

Nametypedef KeywordDescription
typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnCommand)(OH_AVSession* session, AVSession_ControlCommand command, void* userData)OH_AVSessionCallback_OnCommandDefines a callback for a common playback control command.
typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnFastForward)(OH_AVSession* session, uint32_t seekTime, void* userData)OH_AVSessionCallback_OnFastForwardDefines a callback for the fast-forward operation.
typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnRewind)(OH_AVSession* session, uint32_t seekTime, void* userData)OH_AVSessionCallback_OnRewindDefines a callback for the rewind operation.
typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnSeek)(OH_AVSession* session, uint64_t seekTime, void* userData)OH_AVSessionCallback_OnSeekDefines a callback for the seek operation.
typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnSetLoopMode)(OH_AVSession* session, AVSession_LoopMode curLoopMode, void* userData)OH_AVSessionCallback_OnSetLoopModeDefines a callback for the operation of setting the loop mode.
typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnToggleFavorite)(OH_AVSession* session, const char* assetId, void* userData)OH_AVSessionCallback_OnToggleFavoriteDefines a callback for the operation of favoriting a media asset.
AVSession_ErrCode OH_AVSession_Create(AVSession_Type sessionType, const char* sessionTag,const char* bundleName, const char* abilityName, OH_AVSession** avsession)-Creates a session object.
AVSession_ErrCode OH_AVSession_Destroy(OH_AVSession* avsession)-Destroys a session object.
AVSession_ErrCode OH_AVSession_Activate(OH_AVSession* avsession)-Activates a session.
AVSession_ErrCode OH_AVSession_Deactivate(OH_AVSession* avsession)-Deactivates a session.
AVSession_ErrCode OH_AVSession_GetSessionType(OH_AVSession* avsession, AVSession_Type* sessionType)-Obtains the session type.
AVSession_ErrCode OH_AVSession_GetSessionId(OH_AVSession* avsession, const char** sessionId)-Obtains the session ID.
AVSession_ErrCode OH_AVSession_SetAVMetadata(OH_AVSession* avsession, OH_AVMetadata* avmetadata)-Sets media metadata.
AVSession_ErrCode OH_AVSession_SetPlaybackState(OH_AVSession* avsession, AVSession_PlaybackState playbackState)-Sets the playback state.
AVSession_ErrCode OH_AVSession_SetPlaybackPosition(OH_AVSession* avsession, AVSession_PlaybackPosition* playbackPosition)-Sets the playback position.
AVSession_ErrCode OH_AVSession_SetFavorite(OH_AVSession* avsession, bool favorite)-Favorites or unfavorites the media asset.
AVSession_ErrCode OH_AVSession_SetLoopMode(OH_AVSession* avsession, AVSession_LoopMode loopMode)-Sets a loop mode.
AVSession_ErrCode OH_AVSession_RegisterCommandCallback(OH_AVSession* avsession,AVSession_ControlCommand command, OH_AVSessionCallback_OnCommand callback, void* userData)-Registers a callback for a common playback control command.
AVSession_ErrCode OH_AVSession_UnregisterCommandCallback(OH_AVSession* avsession, AVSession_ControlCommand command, OH_AVSessionCallback_OnCommand callback)-Unregisters the callback for a common playback control command.
AVSession_ErrCode OH_AVSession_RegisterForwardCallback(OH_AVSession* avsession, OH_AVSessionCallback_OnFastForward callback, void* userData)-Registers a callback for the fast-forward operation.
AVSession_ErrCode OH_AVSession_UnregisterForwardCallback(OH_AVSession* avsession, OH_AVSessionCallback_OnFastForward callback)-Unregisters the callback for the fast-forward operation.
AVSession_ErrCode OH_AVSession_RegisterRewindCallback(OH_AVSession* avsession, OH_AVSessionCallback_OnRewind callback, void* userData)-Registers a callback for the rewind operation.
AVSession_ErrCode OH_AVSession_UnregisterRewindCallback(OH_AVSession* avsession, OH_AVSessionCallback_OnRewind callback)-Unregisters the callback for the rewind operation.
AVSession_ErrCode OH_AVSession_RegisterSeekCallback(OH_AVSession* avsession, OH_AVSessionCallback_OnSeek callback, void* userData)-Registers a callback for the seek operation.
AVSession_ErrCode OH_AVSession_UnregisterSeekCallback(OH_AVSession* avsession, OH_AVSessionCallback_OnSeek callback)-Unregisters the callback for the seek operation.
AVSession_ErrCode OH_AVSession_RegisterSetLoopModeCallback(OH_AVSession* avsession, OH_AVSessionCallback_OnSetLoopMode callback, void* userData)-Registers a callback for the operation of setting the loop mode.
AVSession_ErrCode OH_AVSession_UnregisterSetLoopModeCallback(OH_AVSession* avsession, OH_AVSessionCallback_OnSetLoopMode callback)-Unregisters the callback for the operation of setting the loop mode.
AVSession_ErrCode OH_AVSession_RegisterToggleFavoriteCallback(OH_AVSession* avsession, OH_AVSessionCallback_OnToggleFavorite callback, void* userData)-Registers a callback for the operation of favoriting a media asset.
AVSession_ErrCode OH_AVSession_UnregisterToggleFavoriteCallback(OH_AVSession* avsession, OH_AVSessionCallback_OnToggleFavorite callback)-Unregisters the callback for the operation of favoriting a media asset.

Enums

AVSession_Type

enum AVSession_Type

Description

Enumerates the session types.

Since: 13

Enum ItemDescription
SESSION_TYPE_AUDIO = 0Audio.
SESSION_TYPE_VIDEO = 1Video.
SESSION_TYPE_VOICE_CALL = 2Audio call.
SESSION_TYPE_VIDEO_CALL = 3Video call.

AVSession_PlaybackState

enum AVSession_PlaybackState

Description

Enumerates the media playback states.

Since: 13

Enum ItemDescription
PLAYBACK_STATE_INITIAL = 0Initial state.
PLAYBACK_STATE_PREPARING = 1Ready.
PLAYBACK_STATE_PLAYING = 2Playing.
PLAYBACK_STATE_PAUSED = 3Paused.
PLAYBACK_STATE_FAST_FORWARDING = 4Fast-forwarding.
PLAYBACK_STATE_REWINDED = 5Rewinded.
PLAYBACK_STATE_STOPPED = 6Stopped.
PLAYBACK_STATE_COMPLETED = 7Playback complete.
PLAYBACK_STATE_RELEASED = 8Released.
PLAYBACK_STATE_ERROR = 9Error.
PLAYBACK_STATE_IDLE = 10Idle.
PLAYBACK_STATE_BUFFERING = 11Buffering.
PLAYBACK_STATE_MAX = 12Maximum value. (Error code 401 is returned in this case.)

AVSession_LoopMode

enum AVSession_LoopMode

Description

Enumerates the loop modes of media playback.

Since: 13

Enum ItemDescription
LOOP_MODE_SEQUENCE = 0Sequential playback.
LOOP_MODE_SINGLE = 1Single loop.
LOOP_MODE_LIST = 2Playlist loop.
LOOP_MODE_SHUFFLE = 3Shuffle.
LOOP_MODE_CUSTOM = 4Custom playback.

AVSession_ControlCommand

enum AVSession_ControlCommand

Description

Enumerates the playback control commands.

Since: 13

Enum ItemDescription
CONTROL_CMD_INVALID = -1Invalid control command.
CONTROL_CMD_PLAY = 0Play command.
CONTROL_CMD_PAUSE = 1Pause command.
CONTROL_CMD_STOP = 2Stop command.
CONTROL_CMD_PLAY_NEXT = 3Command for playing the next media asset.
CONTROL_CMD_PLAY_PREVIOUS = 4Command for playing the previous media asset.

AVSessionCallback_Result

enum AVSessionCallback_Result

Description

Enumerates the callback execution results.

Since: 13

Enum ItemDescription
AVSESSION_CALLBACK_RESULT_SUCCESS = 0The operation is successful.
AVSESSION_CALLBACK_RESULT_FAILURE = -1The operation fails.

Function Description

OH_AVSessionCallback_OnCommand()

typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnCommand)(OH_AVSession* session,AVSession_ControlCommand command, void* userData)

Description

Defines a callback for a common playback control command.

Since: 13

OH_AVSessionCallback_OnFastForward()

typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnFastForward)(OH_AVSession* session,uint32_t seekTime, void* userData)

Description

Defines a callback for the fast-forward operation.

Since: 13

OH_AVSessionCallback_OnRewind()

typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnRewind)(OH_AVSession* session,uint32_t seekTime, void* userData)

Description

Defines a callback for the rewind operation.

Since: 13

OH_AVSessionCallback_OnSeek()

typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnSeek)(OH_AVSession* session,uint64_t seekTime, void* userData)

Description

Defines a callback for the seek operation.

Since: 13

OH_AVSessionCallback_OnSetLoopMode()

typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnSetLoopMode)(OH_AVSession* session,AVSession_LoopMode curLoopMode, void* userData)

Description

Defines a callback for the operation of setting the loop mode.

Since: 13

OH_AVSessionCallback_OnToggleFavorite()

typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnToggleFavorite)(OH_AVSession* session,const char* assetId, void* userData)

Description

Defines a callback for the operation of favoriting a media asset.

Since: 13

OH_AVSession_Create()

AVSession_ErrCode OH_AVSession_Create(AVSession_Type sessionType, const char* sessionTag,const char* bundleName, const char* abilityName, OH_AVSession** avsession)

Description

Creates a session object.

Since: 13

Parameters

NameDescription
AVSession_Type sessionTypeSession type. For details about the available options, see AVSession_Type.
const char* sessionTagPointer to the session tag.
const char* bundleNamePointer to the bundle name.
const char* abilityNamePointer to the ability name.
OH_AVSession** avsessionDouble pointer to the session object created.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_INVALID_PARAMETER:
1. sessionType is invalid.
2. sessionTag is nullptr.
3. bundleName is nullptr.
4. abilityName is nullptr.
5. avsession is nullptr.

OH_AVSession_Destroy()

AVSession_ErrCode OH_AVSession_Destroy(OH_AVSession* avsession)

Description

Destroys a session object.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_INVALID_PARAMETER: avsession is nullptr.

OH_AVSession_Activate()

AVSession_ErrCode OH_AVSession_Activate(OH_AVSession* avsession)

Description

Activates a session.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_INVALID_PARAMETER: avsession is nullptr.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.

OH_AVSession_Deactivate()

AVSession_ErrCode OH_AVSession_Deactivate(OH_AVSession* avsession)

Description

Deactivates a session.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_INVALID_PARAMETER: avsession is nullptr.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.

OH_AVSession_GetSessionType()

AVSession_ErrCode OH_AVSession_GetSessionType(OH_AVSession* avsession, AVSession_Type* sessionType)

Description

Obtains the session type.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
AVSession_Type* sessionTypePointer to the session type obtained.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal or an error occurs.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. sessionType is nullptr.

OH_AVSession_GetSessionId()

AVSession_ErrCode OH_AVSession_GetSessionId(OH_AVSession* avsession, const char** sessionId)

Description

Obtains the session ID.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
const char** sessionIdDouble pointer to the session ID obtained.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. sessionId is nullptr.

OH_AVSession_SetAVMetadata()

AVSession_ErrCode OH_AVSession_SetAVMetadata(OH_AVSession* avsession, OH_AVMetadata* avmetadata)

Description

Sets media metadata.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVMetadata* avmetadataPointer to the media metadata.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. avmetadata is nullptr.

OH_AVSession_SetPlaybackState()

AVSession_ErrCode OH_AVSession_SetPlaybackState(OH_AVSession* avsession,AVSession_PlaybackState playbackState)

Description

Sets the playback state.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
AVSession_PlaybackState playbackStatePlayback state.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. playbackState is invalid.

OH_AVSession_SetPlaybackPosition()

AVSession_ErrCode OH_AVSession_SetPlaybackPosition(OH_AVSession* avsession,AVSession_PlaybackPosition* playbackPosition)

Description

Sets the playback position.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
AVSession_PlaybackPosition* playbackPositionPointer to the playback position.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. playbackPosition is nullptr.

OH_AVSession_SetFavorite()

AVSession_ErrCode OH_AVSession_SetFavorite(OH_AVSession* avsession, bool favorite)

Description

Favorites or unfavorites the media asset.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
bool favoriteWhether to favorite or unfavorite the media asset. true means to favorite, false otherwise.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER: avsession is nullptr.

OH_AVSession_SetLoopMode()

AVSession_ErrCode OH_AVSession_SetLoopMode(OH_AVSession* avsession, AVSession_LoopMode loopMode)

Description

Sets a loop mode.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
AVSession_LoopMode loopModeLoop mode.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. loopMode is invalid.

OH_AVSession_RegisterCommandCallback()

AVSession_ErrCode OH_AVSession_RegisterCommandCallback(OH_AVSession* avsession,AVSession_ControlCommand command, OH_AVSessionCallback_OnCommand callback, void* userData)

Description

Registers a callback for a common playback control command.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
AVSession_ControlCommand commandPlayback control command.
OH_AVSessionCallback_OnCommand callbackCallback for the control command.
void* userDataPointer to the application data passed through the callback functions.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_CODE_COMMAND_INVALID: The playback control command is invalid.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_UnregisterCommandCallback()

AVSession_ErrCode OH_AVSession_UnregisterCommandCallback(OH_AVSession* avsession,AVSession_ControlCommand command, OH_AVSessionCallback_OnCommand callback)

Description

Unregisters the callback for a common playback control command.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
AVSession_ControlCommand commandPlayback control command.
OH_AVSessionCallback_OnCommand callbackCallback for the control command.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_CODE_COMMAND_INVALID: The playback control command is invalid.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_RegisterForwardCallback()

AVSession_ErrCode OH_AVSession_RegisterForwardCallback(OH_AVSession* avsession,OH_AVSessionCallback_OnFastForward callback, void* userData)

Description

Registers a callback for the fast-forward operation.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVSessionCallback_OnFastForward callbackCallback for the fast-forward operation.
void* userDataPointer to the application data passed through the callback functions.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_UnregisterForwardCallback()

AVSession_ErrCode OH_AVSession_UnregisterForwardCallback(OH_AVSession* avsession,OH_AVSessionCallback_OnFastForward callback)

Description

Unregisters the callback for the fast-forward operation.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVSessionCallback_OnFastForward callbackCallback for the fast-forward operation.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_RegisterRewindCallback()

AVSession_ErrCode OH_AVSession_RegisterRewindCallback(OH_AVSession* avsession,OH_AVSessionCallback_OnRewind callback, void* userData)

Description

Registers a callback for the rewind operation.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVSessionCallback_OnRewind callbackCallback for the rewind operation.
void* userDataPointer to the application data passed through the callback functions.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_UnregisterRewindCallback()

AVSession_ErrCode OH_AVSession_UnregisterRewindCallback(OH_AVSession* avsession,OH_AVSessionCallback_OnRewind callback)

Description

Unregisters the callback for the rewind operation.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVSessionCallback_OnRewind callbackCallback for the rewind operation.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_RegisterSeekCallback()

AVSession_ErrCode OH_AVSession_RegisterSeekCallback(OH_AVSession* avsession,OH_AVSessionCallback_OnSeek callback, void* userData)

Description

Registers a callback for the seek operation.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVSessionCallback_OnSeek callbackCallback for the seek operation.
void* userDataPointer to the application data passed through the callback functions.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_UnregisterSeekCallback()

AVSession_ErrCode OH_AVSession_UnregisterSeekCallback(OH_AVSession* avsession,OH_AVSessionCallback_OnSeek callback)

Description

Unregisters the callback for the seek operation.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVSessionCallback_OnSeek callbackCallback for the seek operation.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_RegisterSetLoopModeCallback()

AVSession_ErrCode OH_AVSession_RegisterSetLoopModeCallback(OH_AVSession* avsession,OH_AVSessionCallback_OnSetLoopMode callback, void* userData)

Description

Registers a callback for the operation of setting the loop mode.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVSessionCallback_OnSetLoopMode callbackCallback for the operation of setting the loop mode.
void* userDataPointer to the application data passed through the callback functions.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_UnregisterSetLoopModeCallback()

AVSession_ErrCode OH_AVSession_UnregisterSetLoopModeCallback(OH_AVSession* avsession,OH_AVSessionCallback_OnSetLoopMode callback)

Description

Unregisters the callback for the operation of setting the loop mode.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVSessionCallback_OnSetLoopMode callbackCallback for the operation of setting the loop mode.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_RegisterToggleFavoriteCallback()

AVSession_ErrCode OH_AVSession_RegisterToggleFavoriteCallback(OH_AVSession* avsession,OH_AVSessionCallback_OnToggleFavorite callback, void* userData)

Description

Registers a callback for the operation of favoriting a media asset.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVSessionCallback_OnToggleFavorite callbackCallback for the operation of favoriting a media asset.
void* userDataPointer to the application data passed through the callback functions.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

OH_AVSession_UnregisterToggleFavoriteCallback()

AVSession_ErrCode OH_AVSession_UnregisterToggleFavoriteCallback(OH_AVSession* avsession,OH_AVSessionCallback_OnToggleFavorite callback)

Description

Unregisters the callback for the operation of favoriting a media asset.

Since: 13

Parameters

NameDescription
OH_AVSession* avsessionPointer to a session object.
OH_AVSessionCallback_OnToggleFavorite callbackCallback for the operation of favoriting a media asset.

Returns

TypeDescription
AVSession_ErrCodeAV_SESSION_ERR_SUCCESS: The function is executed successfully.
AV_SESSION_ERR_SERVICE_EXCEPTION: The session service is abnormal.
AV_SESSION_ERR_INVALID_PARAMETER:
1. avsession is nullptr.
2. callback is nullptr.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-avsession

openharmony 鸿蒙 arkts-apis-avsession-e

openharmony 鸿蒙 errorcode-avsession

openharmony 鸿蒙 js-apis-inner-application-MediaControlExtensionContext-sys

openharmony 鸿蒙 arkts-apis-avsession-AVSession

openharmony 鸿蒙 ohos-multimedia-avcastpicker

openharmony 鸿蒙 arkts-apis-avsession-AVCastController

openharmony 鸿蒙 arkts-apis-avsession-AVCastPickerHelper

openharmony 鸿蒙 capi-native-avmetadata-h

openharmony 鸿蒙 arkts-apis-avsession-t

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