180922886Sopenharmony_ci/* 280922886Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 380922886Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 480922886Sopenharmony_ci * you may not use this file except in compliance with the License. 580922886Sopenharmony_ci * You may obtain a copy of the License at 680922886Sopenharmony_ci * 780922886Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 880922886Sopenharmony_ci * 980922886Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1080922886Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1180922886Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1280922886Sopenharmony_ci * See the License for the specific language governing permissions and 1380922886Sopenharmony_ci * limitations under the License. 1480922886Sopenharmony_ci */ 1580922886Sopenharmony_ci 1680922886Sopenharmony_ci/** 1780922886Sopenharmony_ci * @addtogroup OHAVSession 1880922886Sopenharmony_ci * @{ 1980922886Sopenharmony_ci * 2080922886Sopenharmony_ci * @brief Provide the definition of the C interface for the avsession module. 2180922886Sopenharmony_ci * 2280922886Sopenharmony_ci * @syscap SystemCapability.Multimedia.AVSession.Core 2380922886Sopenharmony_ci * 2480922886Sopenharmony_ci * @since 13 2580922886Sopenharmony_ci * @version 1.0 2680922886Sopenharmony_ci */ 2780922886Sopenharmony_ci 2880922886Sopenharmony_ci/** 2980922886Sopenharmony_ci * @file native_avsession.h 3080922886Sopenharmony_ci * 3180922886Sopenharmony_ci * @brief Declare avsession interface. 3280922886Sopenharmony_ci * 3380922886Sopenharmony_ci * @library libohavsession.so 3480922886Sopenharmony_ci * @syscap SystemCapability.Multimedia.AVSession.Core 3580922886Sopenharmony_ci * @kit AVSessionKit 3680922886Sopenharmony_ci * @since 13 3780922886Sopenharmony_ci * @version 1.0 3880922886Sopenharmony_ci */ 3980922886Sopenharmony_ci 4080922886Sopenharmony_ci#ifndef NATIVE_AVSESSION_H 4180922886Sopenharmony_ci#define NATIVE_AVSESSION_H 4280922886Sopenharmony_ci 4380922886Sopenharmony_ci#include <stdint.h> 4480922886Sopenharmony_ci#include "native_avsession_errors.h" 4580922886Sopenharmony_ci#include "native_avmetadata.h" 4680922886Sopenharmony_ci 4780922886Sopenharmony_ci#ifdef __cplusplus 4880922886Sopenharmony_ciextern "C" { 4980922886Sopenharmony_ci#endif 5080922886Sopenharmony_ci 5180922886Sopenharmony_ci/** 5280922886Sopenharmony_ci * @brief Enum for avsession type. 5380922886Sopenharmony_ci * 5480922886Sopenharmony_ci * @since 13 5580922886Sopenharmony_ci * @version 1.0 5680922886Sopenharmony_ci */ 5780922886Sopenharmony_citypedef enum { 5880922886Sopenharmony_ci /** 5980922886Sopenharmony_ci * @brief audio session type. 6080922886Sopenharmony_ci */ 6180922886Sopenharmony_ci SESSION_TYPE_AUDIO = 0, 6280922886Sopenharmony_ci 6380922886Sopenharmony_ci /** 6480922886Sopenharmony_ci * @brief video session type. 6580922886Sopenharmony_ci */ 6680922886Sopenharmony_ci SESSION_TYPE_VIDEO = 1, 6780922886Sopenharmony_ci 6880922886Sopenharmony_ci /** 6980922886Sopenharmony_ci * @brief voice call session type. 7080922886Sopenharmony_ci */ 7180922886Sopenharmony_ci SESSION_TYPE_VOICE_CALL = 2, 7280922886Sopenharmony_ci 7380922886Sopenharmony_ci /** 7480922886Sopenharmony_ci * @brief video call session type. 7580922886Sopenharmony_ci */ 7680922886Sopenharmony_ci SESSION_TYPE_VIDEO_CALL = 3 7780922886Sopenharmony_ci} AVSession_Type; 7880922886Sopenharmony_ci 7980922886Sopenharmony_ci/** 8080922886Sopenharmony_ci * @brief Enum for playback state. 8180922886Sopenharmony_ci * 8280922886Sopenharmony_ci * @since 13 8380922886Sopenharmony_ci * @version 1.0 8480922886Sopenharmony_ci */ 8580922886Sopenharmony_citypedef enum { 8680922886Sopenharmony_ci /** 8780922886Sopenharmony_ci * @brief Initial state. 8880922886Sopenharmony_ci */ 8980922886Sopenharmony_ci PLAYBACK_STATE_INITIAL = 0, 9080922886Sopenharmony_ci 9180922886Sopenharmony_ci /** 9280922886Sopenharmony_ci * @brief Preparing state. Indicates that the media file is not ready to play. 9380922886Sopenharmony_ci */ 9480922886Sopenharmony_ci PLAYBACK_STATE_PREPARING = 1, 9580922886Sopenharmony_ci 9680922886Sopenharmony_ci /** 9780922886Sopenharmony_ci * @brief Playing state. 9880922886Sopenharmony_ci */ 9980922886Sopenharmony_ci PLAYBACK_STATE_PLAYING = 2, 10080922886Sopenharmony_ci 10180922886Sopenharmony_ci /** 10280922886Sopenharmony_ci * @brief Pause state. 10380922886Sopenharmony_ci */ 10480922886Sopenharmony_ci PLAYBACK_STATE_PAUSED = 3, 10580922886Sopenharmony_ci 10680922886Sopenharmony_ci /** 10780922886Sopenharmony_ci * @brief Fast forward state. 10880922886Sopenharmony_ci */ 10980922886Sopenharmony_ci PLAYBACK_STATE_FAST_FORWARDING = 4, 11080922886Sopenharmony_ci 11180922886Sopenharmony_ci /** 11280922886Sopenharmony_ci * @brief Rewind state. 11380922886Sopenharmony_ci */ 11480922886Sopenharmony_ci PLAYBACK_STATE_REWINDED = 5, 11580922886Sopenharmony_ci 11680922886Sopenharmony_ci /** 11780922886Sopenharmony_ci * @brief Stopped state. 11880922886Sopenharmony_ci */ 11980922886Sopenharmony_ci PLAYBACK_STATE_STOPPED = 6, 12080922886Sopenharmony_ci 12180922886Sopenharmony_ci /** 12280922886Sopenharmony_ci * @brief Complete state. 12380922886Sopenharmony_ci */ 12480922886Sopenharmony_ci PLAYBACK_STATE_COMPLETED = 7, 12580922886Sopenharmony_ci 12680922886Sopenharmony_ci /** 12780922886Sopenharmony_ci * @brief Release state. 12880922886Sopenharmony_ci */ 12980922886Sopenharmony_ci PLAYBACK_STATE_RELEASED = 8, 13080922886Sopenharmony_ci 13180922886Sopenharmony_ci /** 13280922886Sopenharmony_ci * @brief Error state. 13380922886Sopenharmony_ci */ 13480922886Sopenharmony_ci PLAYBACK_STATE_ERROR = 9, 13580922886Sopenharmony_ci 13680922886Sopenharmony_ci /** 13780922886Sopenharmony_ci * @brief Idle state. 13880922886Sopenharmony_ci */ 13980922886Sopenharmony_ci PLAYBACK_STATE_IDLE = 10, 14080922886Sopenharmony_ci 14180922886Sopenharmony_ci /** 14280922886Sopenharmony_ci * @brief Buffering state. 14380922886Sopenharmony_ci */ 14480922886Sopenharmony_ci PLAYBACK_STATE_BUFFERING = 11, 14580922886Sopenharmony_ci 14680922886Sopenharmony_ci /** 14780922886Sopenharmony_ci * @brief Max state. 14880922886Sopenharmony_ci */ 14980922886Sopenharmony_ci PLAYBACK_STATE_MAX = 12, 15080922886Sopenharmony_ci} AVSession_PlaybackState; 15180922886Sopenharmony_ci 15280922886Sopenharmony_ci/** 15380922886Sopenharmony_ci * @brief Defines the playback position. 15480922886Sopenharmony_ci * 15580922886Sopenharmony_ci * @since 13 15680922886Sopenharmony_ci */ 15780922886Sopenharmony_citypedef struct AVSession_PlaybackPosition { 15880922886Sopenharmony_ci /** 15980922886Sopenharmony_ci * @brief Elapsed time(position) of this media set by the app. 16080922886Sopenharmony_ci */ 16180922886Sopenharmony_ci int64_t elapsedTime; 16280922886Sopenharmony_ci 16380922886Sopenharmony_ci /** 16480922886Sopenharmony_ci * @brief Record the system time when elapsedTime is set. 16580922886Sopenharmony_ci */ 16680922886Sopenharmony_ci int64_t updateTime; 16780922886Sopenharmony_ci} AVSession_PlaybackPosition; 16880922886Sopenharmony_ci 16980922886Sopenharmony_ci/** 17080922886Sopenharmony_ci * @brief Defines the playback mode. 17180922886Sopenharmony_ci * 17280922886Sopenharmony_ci * @since 13 17380922886Sopenharmony_ci */ 17480922886Sopenharmony_citypedef enum { 17580922886Sopenharmony_ci /** 17680922886Sopenharmony_ci * @brief sequential playback mode 17780922886Sopenharmony_ci */ 17880922886Sopenharmony_ci LOOP_MODE_SEQUENCE = 0, 17980922886Sopenharmony_ci 18080922886Sopenharmony_ci /** 18180922886Sopenharmony_ci * @brief single playback mode 18280922886Sopenharmony_ci */ 18380922886Sopenharmony_ci LOOP_MODE_SINGLE = 1, 18480922886Sopenharmony_ci 18580922886Sopenharmony_ci /** 18680922886Sopenharmony_ci * @brief list playback mode 18780922886Sopenharmony_ci */ 18880922886Sopenharmony_ci LOOP_MODE_LIST = 2, 18980922886Sopenharmony_ci 19080922886Sopenharmony_ci /** 19180922886Sopenharmony_ci * @brief shuffle playback mode 19280922886Sopenharmony_ci */ 19380922886Sopenharmony_ci LOOP_MODE_SHUFFLE = 3, 19480922886Sopenharmony_ci 19580922886Sopenharmony_ci /** 19680922886Sopenharmony_ci * @brief custom playback mode 19780922886Sopenharmony_ci */ 19880922886Sopenharmony_ci LOOP_MODE_CUSTOM = 4, 19980922886Sopenharmony_ci} AVSession_LoopMode; 20080922886Sopenharmony_ci 20180922886Sopenharmony_ci/** 20280922886Sopenharmony_ci * @brief Enum for different control command. 20380922886Sopenharmony_ci * 20480922886Sopenharmony_ci * @since 13 20580922886Sopenharmony_ci * @version 1.0 20680922886Sopenharmony_ci */ 20780922886Sopenharmony_citypedef enum AVSession_ControlCommand { 20880922886Sopenharmony_ci /** 20980922886Sopenharmony_ci * @brief invalid control command 21080922886Sopenharmony_ci */ 21180922886Sopenharmony_ci CONTROL_CMD_INVALID = -1, 21280922886Sopenharmony_ci 21380922886Sopenharmony_ci /** 21480922886Sopenharmony_ci * @brief play command 21580922886Sopenharmony_ci */ 21680922886Sopenharmony_ci CONTROL_CMD_PLAY = 0, 21780922886Sopenharmony_ci 21880922886Sopenharmony_ci /** 21980922886Sopenharmony_ci * @brief pause command 22080922886Sopenharmony_ci */ 22180922886Sopenharmony_ci CONTROL_CMD_PAUSE = 1, 22280922886Sopenharmony_ci 22380922886Sopenharmony_ci /** 22480922886Sopenharmony_ci * @brief stop command 22580922886Sopenharmony_ci */ 22680922886Sopenharmony_ci CONTROL_CMD_STOP = 2, 22780922886Sopenharmony_ci 22880922886Sopenharmony_ci /** 22980922886Sopenharmony_ci * @brief playnext command 23080922886Sopenharmony_ci */ 23180922886Sopenharmony_ci CONTROL_CMD_PLAY_NEXT = 3, 23280922886Sopenharmony_ci 23380922886Sopenharmony_ci /** 23480922886Sopenharmony_ci * @brief playprevious command 23580922886Sopenharmony_ci */ 23680922886Sopenharmony_ci CONTROL_CMD_PLAY_PREVIOUS = 4, 23780922886Sopenharmony_ci} AVSession_ControlCommand; 23880922886Sopenharmony_ci 23980922886Sopenharmony_ci/** 24080922886Sopenharmony_ci * @brief Defines enumeration of avsession callback result. 24180922886Sopenharmony_ci * 24280922886Sopenharmony_ci * @since 13 24380922886Sopenharmony_ci */ 24480922886Sopenharmony_citypedef enum { 24580922886Sopenharmony_ci /** 24680922886Sopenharmony_ci * @brief Result of avsession callabck is success. 24780922886Sopenharmony_ci */ 24880922886Sopenharmony_ci AVSESSION_CALLBACK_RESULT_SUCCESS = 0, 24980922886Sopenharmony_ci 25080922886Sopenharmony_ci /** 25180922886Sopenharmony_ci * @brief Result of avsession callabck failed. 25280922886Sopenharmony_ci */ 25380922886Sopenharmony_ci AVSESSION_CALLBACK_RESULT_FAILURE = -1, 25480922886Sopenharmony_ci} AVSessionCallback_Result; 25580922886Sopenharmony_ci 25680922886Sopenharmony_ci/** 25780922886Sopenharmony_ci * @brief AVSession object 25880922886Sopenharmony_ci * 25980922886Sopenharmony_ci * A pointer can be created using {@link OH_AVSession_Create} method. 26080922886Sopenharmony_ci * 26180922886Sopenharmony_ci * @since 13 26280922886Sopenharmony_ci * @version 1.0 26380922886Sopenharmony_ci */ 26480922886Sopenharmony_citypedef struct OH_AVSession OH_AVSession; 26580922886Sopenharmony_ci 26680922886Sopenharmony_ci/** 26780922886Sopenharmony_ci * @brief Declaring the callback struct for playback command 26880922886Sopenharmony_ci * 26980922886Sopenharmony_ci * @since 13 27080922886Sopenharmony_ci * @version 1.0 27180922886Sopenharmony_ci */ 27280922886Sopenharmony_citypedef AVSessionCallback_Result (*OH_AVSessionCallback_OnCommand)(OH_AVSession* session, 27380922886Sopenharmony_ci AVSession_ControlCommand command, void* userData); 27480922886Sopenharmony_ci 27580922886Sopenharmony_ci/** 27680922886Sopenharmony_ci * @brief Declaring the callback struct for forward command 27780922886Sopenharmony_ci * 27880922886Sopenharmony_ci * @since 13 27980922886Sopenharmony_ci * @version 1.0 28080922886Sopenharmony_ci */ 28180922886Sopenharmony_citypedef AVSessionCallback_Result (*OH_AVSessionCallback_OnFastForward)(OH_AVSession* session, 28280922886Sopenharmony_ci uint32_t seekTime, void* userData); 28380922886Sopenharmony_ci 28480922886Sopenharmony_ci/** 28580922886Sopenharmony_ci * @brief Declaring the callback struct for rewind command 28680922886Sopenharmony_ci * 28780922886Sopenharmony_ci * @since 13 28880922886Sopenharmony_ci * @version 1.0 28980922886Sopenharmony_ci */ 29080922886Sopenharmony_citypedef AVSessionCallback_Result (*OH_AVSessionCallback_OnRewind)(OH_AVSession* session, 29180922886Sopenharmony_ci uint32_t seekTime, void* userData); 29280922886Sopenharmony_ci 29380922886Sopenharmony_ci/** 29480922886Sopenharmony_ci * @brief Declaring the callback struct for seek command 29580922886Sopenharmony_ci * 29680922886Sopenharmony_ci * @since 13 29780922886Sopenharmony_ci * @version 1.0 29880922886Sopenharmony_ci */ 29980922886Sopenharmony_citypedef AVSessionCallback_Result (*OH_AVSessionCallback_OnSeek)(OH_AVSession* session, 30080922886Sopenharmony_ci uint64_t seekTime, void* userData); 30180922886Sopenharmony_ci 30280922886Sopenharmony_ci/** 30380922886Sopenharmony_ci * @brief Declaring the callback struct for set loop mode command 30480922886Sopenharmony_ci * 30580922886Sopenharmony_ci * @since 13 30680922886Sopenharmony_ci * @version 1.0 30780922886Sopenharmony_ci */ 30880922886Sopenharmony_citypedef AVSessionCallback_Result (*OH_AVSessionCallback_OnSetLoopMode)(OH_AVSession* session, 30980922886Sopenharmony_ci AVSession_LoopMode curLoopMode, void* userData); 31080922886Sopenharmony_ci 31180922886Sopenharmony_ci/** 31280922886Sopenharmony_ci * @brief Declaring the callback struct for toggle favorite command 31380922886Sopenharmony_ci * 31480922886Sopenharmony_ci * @since 13 31580922886Sopenharmony_ci * @version 1.0 31680922886Sopenharmony_ci */ 31780922886Sopenharmony_citypedef AVSessionCallback_Result (*OH_AVSessionCallback_OnToggleFavorite)(OH_AVSession* session, 31880922886Sopenharmony_ci const char* assetId, void* userData); 31980922886Sopenharmony_ci 32080922886Sopenharmony_ci/** 32180922886Sopenharmony_ci * @brief Request to create the avsession. 32280922886Sopenharmony_ci * 32380922886Sopenharmony_ci * @param sessionType The session type to set 32480922886Sopenharmony_ci * @param sessionTag The session tag set by the application 32580922886Sopenharmony_ci * @param bundleName The bundle name to set 32680922886Sopenharmony_ci * @param abilityName The abilityName name to set 32780922886Sopenharmony_ci * @param avsession Pointer to a viriable to receive the OH_AVSession 32880922886Sopenharmony_ci * @return Function result code: 32980922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 33080922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} If session already existed or internal server error. 33180922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER}: 33280922886Sopenharmony_ci * 1. The param of sessionType is invalid. 33380922886Sopenharmony_ci * 2. The param of sessionTag is nullptr. 33480922886Sopenharmony_ci * 3. The param of bundleName is nullptr. 33580922886Sopenharmony_ci * 4. The param of abilityName is nullptr. 33680922886Sopenharmony_ci * 5. The param of avsession is nullptr. 33780922886Sopenharmony_ci * @since 13 33880922886Sopenharmony_ci */ 33980922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_Create(AVSession_Type sessionType, const char* sessionTag, 34080922886Sopenharmony_ci const char* bundleName, const char* abilityName, OH_AVSession** avsession); 34180922886Sopenharmony_ci 34280922886Sopenharmony_ci/** 34380922886Sopenharmony_ci * @brief Request to destory the avsession. 34480922886Sopenharmony_ci * 34580922886Sopenharmony_ci * @param avsession The avsession instance pointer 34680922886Sopenharmony_ci * @return Function result code: 34780922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 34880922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 34980922886Sopenharmony_ci * @since 13 35080922886Sopenharmony_ci */ 35180922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_Destroy(OH_AVSession* avsession); 35280922886Sopenharmony_ci 35380922886Sopenharmony_ci/** 35480922886Sopenharmony_ci * @brief Activate the avsession. 35580922886Sopenharmony_ci * 35680922886Sopenharmony_ci * @param avsession The avsession instance pointer 35780922886Sopenharmony_ci * @return Function result code: 35880922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 35980922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 36080922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 36180922886Sopenharmony_ci * @since 13 36280922886Sopenharmony_ci */ 36380922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_Activate(OH_AVSession* avsession); 36480922886Sopenharmony_ci 36580922886Sopenharmony_ci/** 36680922886Sopenharmony_ci * @brief Deactivate the avsession. 36780922886Sopenharmony_ci * 36880922886Sopenharmony_ci * @param avsession The avsession instance pointer 36980922886Sopenharmony_ci * @return Function result code: 37080922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 37180922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 37280922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 37380922886Sopenharmony_ci * @since 13 37480922886Sopenharmony_ci */ 37580922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_Deactivate(OH_AVSession* avsession); 37680922886Sopenharmony_ci 37780922886Sopenharmony_ci/** 37880922886Sopenharmony_ci * @brief Get session type. 37980922886Sopenharmony_ci * 38080922886Sopenharmony_ci * @param avsession The avsession instance pointer 38180922886Sopenharmony_ci * @param sessionType The returned session type 38280922886Sopenharmony_ci * @return Function result code: 38380922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 38480922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 38580922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 38680922886Sopenharmony_ci * 1. The param of avsession is invalid. 38780922886Sopenharmony_ci * 2. The param of sessionType is nullptr. 38880922886Sopenharmony_ci * @since 13 38980922886Sopenharmony_ci */ 39080922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_GetSessionType(OH_AVSession* avsession, AVSession_Type* sessionType); 39180922886Sopenharmony_ci 39280922886Sopenharmony_ci/** 39380922886Sopenharmony_ci * @brief Get session id. 39480922886Sopenharmony_ci * 39580922886Sopenharmony_ci * @param avsession The avsession instance pointer 39680922886Sopenharmony_ci * @param sessionId The returned session id 39780922886Sopenharmony_ci * @return Function result code: 39880922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 39980922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 40080922886Sopenharmony_ci * 1. The param of avsession is nullptr. 40180922886Sopenharmony_ci * 2. The param of sessionId is nullptr. 40280922886Sopenharmony_ci * @since 13 40380922886Sopenharmony_ci */ 40480922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_GetSessionId(OH_AVSession* avsession, const char** sessionId); 40580922886Sopenharmony_ci 40680922886Sopenharmony_ci/** 40780922886Sopenharmony_ci * @brief Request to set av metadata. 40880922886Sopenharmony_ci * 40980922886Sopenharmony_ci * @param avsession The avsession instance pointer 41080922886Sopenharmony_ci * @param avmetadata The metadata to set 41180922886Sopenharmony_ci * @return Function result code: 41280922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 41380922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 41480922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 41580922886Sopenharmony_ci * 1. The param of avsession is nullptr. 41680922886Sopenharmony_ci * 2. The param of avmetadata is nullptr. 41780922886Sopenharmony_ci * @since 13 41880922886Sopenharmony_ci */ 41980922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_SetAVMetadata(OH_AVSession* avsession, OH_AVMetadata* avmetadata); 42080922886Sopenharmony_ci 42180922886Sopenharmony_ci/** 42280922886Sopenharmony_ci * @brief Request to set av playbackstate. 42380922886Sopenharmony_ci * 42480922886Sopenharmony_ci * @param avsession The avsession instance pointer 42580922886Sopenharmony_ci * @param playbackState The playbackState to set 42680922886Sopenharmony_ci * @return Function result code: 42780922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 42880922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 42980922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 43080922886Sopenharmony_ci * 1. The param of avsession is nullptr. 43180922886Sopenharmony_ci * 2. The param of playbackState is invalid. 43280922886Sopenharmony_ci * @since 13 43380922886Sopenharmony_ci */ 43480922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_SetPlaybackState(OH_AVSession* avsession, 43580922886Sopenharmony_ci AVSession_PlaybackState playbackState); 43680922886Sopenharmony_ci 43780922886Sopenharmony_ci/** 43880922886Sopenharmony_ci * @brief Request to set playback position. 43980922886Sopenharmony_ci * 44080922886Sopenharmony_ci * @param avsession The avsession instance pointer 44180922886Sopenharmony_ci * @param playbackPosition The playbackPosition to set 44280922886Sopenharmony_ci * @return Function result code: 44380922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 44480922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 44580922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 44680922886Sopenharmony_ci * 1. The param of avsession is nullptr. 44780922886Sopenharmony_ci * 2. The param of playbackPosition is nullptr. 44880922886Sopenharmony_ci * @since 13 44980922886Sopenharmony_ci */ 45080922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_SetPlaybackPosition(OH_AVSession* avsession, 45180922886Sopenharmony_ci AVSession_PlaybackPosition* playbackPosition); 45280922886Sopenharmony_ci 45380922886Sopenharmony_ci/** 45480922886Sopenharmony_ci * @brief Request to set favorite state. 45580922886Sopenharmony_ci * 45680922886Sopenharmony_ci * @param avsession The avsession instance pointer 45780922886Sopenharmony_ci * @param favorite true means making the resource to be liked, false means dislike. 45880922886Sopenharmony_ci * @return Function result code: 45980922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 46080922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 46180922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 46280922886Sopenharmony_ci * @since 13 46380922886Sopenharmony_ci */ 46480922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_SetFavorite(OH_AVSession* avsession, bool favorite); 46580922886Sopenharmony_ci 46680922886Sopenharmony_ci/** 46780922886Sopenharmony_ci * @brief Request to set loop mode. 46880922886Sopenharmony_ci * 46980922886Sopenharmony_ci * @param avsession The avsession instance pointer 47080922886Sopenharmony_ci * @param loopMode The loopmode to be set for playback. 47180922886Sopenharmony_ci * @return Function result code: 47280922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 47380922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 47480922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 47580922886Sopenharmony_ci * 1. The param of avsession is nullptr. 47680922886Sopenharmony_ci * 2. The param of loopMode is invalid. 47780922886Sopenharmony_ci * @since 13 47880922886Sopenharmony_ci */ 47980922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_SetLoopMode(OH_AVSession* avsession, AVSession_LoopMode loopMode); 48080922886Sopenharmony_ci 48180922886Sopenharmony_ci/** 48280922886Sopenharmony_ci * @brief Request to register command callback. 48380922886Sopenharmony_ci * 48480922886Sopenharmony_ci * @param avsession The avsession instance pointer 48580922886Sopenharmony_ci * @param command The control command type to be registered. 48680922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnCommand} to be registered. 48780922886Sopenharmony_ci * @param userData User data which is passed by user. 48880922886Sopenharmony_ci * @return Function result code: 48980922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 49080922886Sopenharmony_ci * {@link AV_SESSION_ERR_CODE_COMMAND_INVALID} The command is invalid. 49180922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 49280922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 49380922886Sopenharmony_ci * 1. The param of avsession is nullptr. 49480922886Sopenharmony_ci * 2. The param of callback is nullptr. 49580922886Sopenharmony_ci * @since 13 49680922886Sopenharmony_ci */ 49780922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_RegisterCommandCallback(OH_AVSession* avsession, 49880922886Sopenharmony_ci AVSession_ControlCommand command, OH_AVSessionCallback_OnCommand callback, void* userData); 49980922886Sopenharmony_ci 50080922886Sopenharmony_ci/** 50180922886Sopenharmony_ci * @brief Request to unregister command callback. 50280922886Sopenharmony_ci * 50380922886Sopenharmony_ci * @param avsession The avsession instance pointer 50480922886Sopenharmony_ci * @param command The control command type to be unregistered. 50580922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnCommand} to be unregistered. 50680922886Sopenharmony_ci * @return Function result code: 50780922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 50880922886Sopenharmony_ci * {@link AV_SESSION_ERR_CODE_COMMAND_INVALID} The command is invalid. 50980922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 51080922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 51180922886Sopenharmony_ci * 1. The param of avsession is nullptr. 51280922886Sopenharmony_ci * 2. The param of callback is nullptr. 51380922886Sopenharmony_ci * @since 13 51480922886Sopenharmony_ci */ 51580922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_UnregisterCommandCallback(OH_AVSession* avsession, 51680922886Sopenharmony_ci AVSession_ControlCommand command, OH_AVSessionCallback_OnCommand callback); 51780922886Sopenharmony_ci 51880922886Sopenharmony_ci/** 51980922886Sopenharmony_ci * @brief Request to register fastforward callback. 52080922886Sopenharmony_ci * 52180922886Sopenharmony_ci * @param avsession The avsession instance pointer 52280922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnFastForward} to be registered. 52380922886Sopenharmony_ci * @param userData User data which is passed by user. 52480922886Sopenharmony_ci * @return Function result code: 52580922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 52680922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 52780922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 52880922886Sopenharmony_ci * 1. The param of avsession is nullptr. 52980922886Sopenharmony_ci * 2. The param of callback is nullptr. 53080922886Sopenharmony_ci * @since 13 53180922886Sopenharmony_ci */ 53280922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_RegisterForwardCallback(OH_AVSession* avsession, 53380922886Sopenharmony_ci OH_AVSessionCallback_OnFastForward callback, void* userData); 53480922886Sopenharmony_ci 53580922886Sopenharmony_ci/** 53680922886Sopenharmony_ci * @brief Request to unregister fastforward callback. 53780922886Sopenharmony_ci * 53880922886Sopenharmony_ci * @param avsession The avsession instance pointer 53980922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnFastForward} to be unregistered. 54080922886Sopenharmony_ci * @return Function result code: 54180922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 54280922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 54380922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 54480922886Sopenharmony_ci * 1. The param of avsession is nullptr. 54580922886Sopenharmony_ci * 2. The param of callback is nullptr. 54680922886Sopenharmony_ci * @since 13 54780922886Sopenharmony_ci */ 54880922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_UnregisterForwardCallback(OH_AVSession* avsession, 54980922886Sopenharmony_ci OH_AVSessionCallback_OnFastForward callback); 55080922886Sopenharmony_ci 55180922886Sopenharmony_ci/** 55280922886Sopenharmony_ci * @brief Request to register rewind callback. 55380922886Sopenharmony_ci * 55480922886Sopenharmony_ci * @param avsession The avsession instance pointer 55580922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnRewind} to be registered. 55680922886Sopenharmony_ci * @param userData User data which is passed by user. 55780922886Sopenharmony_ci * @return Function result code: 55880922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 55980922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 56080922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 56180922886Sopenharmony_ci * 1. The param of avsession is nullptr. 56280922886Sopenharmony_ci * 2. The param of callback is nullptr. 56380922886Sopenharmony_ci * @since 13 56480922886Sopenharmony_ci */ 56580922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_RegisterRewindCallback(OH_AVSession* avsession, 56680922886Sopenharmony_ci OH_AVSessionCallback_OnRewind callback, void* userData); 56780922886Sopenharmony_ci 56880922886Sopenharmony_ci/** 56980922886Sopenharmony_ci * @brief Request to unregister rewind callback. 57080922886Sopenharmony_ci * 57180922886Sopenharmony_ci * @param avsession The avsession instance pointer 57280922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnRewind} to be unregistered. 57380922886Sopenharmony_ci * @return Function result code: 57480922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 57580922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 57680922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 57780922886Sopenharmony_ci * 1. The param of avsession is nullptr. 57880922886Sopenharmony_ci * 2. The param of callback is nullptr. 57980922886Sopenharmony_ci * @since 13 58080922886Sopenharmony_ci */ 58180922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_UnregisterRewindCallback(OH_AVSession* avsession, 58280922886Sopenharmony_ci OH_AVSessionCallback_OnRewind callback); 58380922886Sopenharmony_ci 58480922886Sopenharmony_ci/** 58580922886Sopenharmony_ci * @brief Request to register seek callback. 58680922886Sopenharmony_ci * 58780922886Sopenharmony_ci * @param avsession The avsession instance pointer 58880922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnSeek} to be registered. 58980922886Sopenharmony_ci * @param userData User data which is passed by user. 59080922886Sopenharmony_ci * @return Function result code: 59180922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 59280922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 59380922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 59480922886Sopenharmony_ci * 1. The param of avsession is nullptr. 59580922886Sopenharmony_ci * 2. The param of callback is nullptr. 59680922886Sopenharmony_ci * @since 13 59780922886Sopenharmony_ci */ 59880922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_RegisterSeekCallback(OH_AVSession* avsession, 59980922886Sopenharmony_ci OH_AVSessionCallback_OnSeek callback, void* userData); 60080922886Sopenharmony_ci 60180922886Sopenharmony_ci/** 60280922886Sopenharmony_ci * @brief Request to unregister seek callback. 60380922886Sopenharmony_ci * 60480922886Sopenharmony_ci * @param avsession The avsession instance pointer 60580922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnSeek} to be unregistered. 60680922886Sopenharmony_ci * @return Function result code: 60780922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 60880922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 60980922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 61080922886Sopenharmony_ci * 1. The param of avsession is nullptr. 61180922886Sopenharmony_ci * 2. The param of callback is nullptr. 61280922886Sopenharmony_ci * @since 13 61380922886Sopenharmony_ci */ 61480922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_UnregisterSeekCallback(OH_AVSession* avsession, 61580922886Sopenharmony_ci OH_AVSessionCallback_OnSeek callback); 61680922886Sopenharmony_ci 61780922886Sopenharmony_ci/** 61880922886Sopenharmony_ci * @brief Request to register set loopmode callback. 61980922886Sopenharmony_ci * 62080922886Sopenharmony_ci * @param avsession The avsession instance pointer 62180922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnSetLoopMode} to be registered. 62280922886Sopenharmony_ci * @param userData User data which is passed by user. 62380922886Sopenharmony_ci * @return Function result code: 62480922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 62580922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 62680922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 62780922886Sopenharmony_ci * 1. The param of avsession is nullptr. 62880922886Sopenharmony_ci * 2. The param of callback is nullptr. 62980922886Sopenharmony_ci * @since 13 63080922886Sopenharmony_ci */ 63180922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_RegisterSetLoopModeCallback(OH_AVSession* avsession, 63280922886Sopenharmony_ci OH_AVSessionCallback_OnSetLoopMode callback, void* userData); 63380922886Sopenharmony_ci 63480922886Sopenharmony_ci/** 63580922886Sopenharmony_ci * @brief Request to unregister set loopmode callback. 63680922886Sopenharmony_ci * 63780922886Sopenharmony_ci * @param avsession The avsession instance pointer 63880922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnSetLoopMode} to be unregistered. 63980922886Sopenharmony_ci * @return Function result code: 64080922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 64180922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 64280922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 64380922886Sopenharmony_ci * 1. The param of avsession is nullptr. 64480922886Sopenharmony_ci * 2. The param of callback is nullptr. 64580922886Sopenharmony_ci * @since 13 64680922886Sopenharmony_ci */ 64780922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_UnregisterSetLoopModeCallback(OH_AVSession* avsession, 64880922886Sopenharmony_ci OH_AVSessionCallback_OnSetLoopMode callback); 64980922886Sopenharmony_ci 65080922886Sopenharmony_ci/** 65180922886Sopenharmony_ci * @brief Request to register toggle favorite callback. 65280922886Sopenharmony_ci * 65380922886Sopenharmony_ci * @param avsession The avsession instance pointer 65480922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnToggleFavorite} to be registered. 65580922886Sopenharmony_ci * @param userData User data which is passed by user. 65680922886Sopenharmony_ci * @return Function result code: 65780922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 65880922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 65980922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 66080922886Sopenharmony_ci * 1. The param of avsession is nullptr. 66180922886Sopenharmony_ci * 2. The param of callback is nullptr. 66280922886Sopenharmony_ci * @since 13 66380922886Sopenharmony_ci */ 66480922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_RegisterToggleFavoriteCallback(OH_AVSession* avsession, 66580922886Sopenharmony_ci OH_AVSessionCallback_OnToggleFavorite callback, void* userData); 66680922886Sopenharmony_ci 66780922886Sopenharmony_ci/** 66880922886Sopenharmony_ci * @brief Request to unregister toggle favorite callback. 66980922886Sopenharmony_ci * 67080922886Sopenharmony_ci * @param avsession The avsession instance pointer 67180922886Sopenharmony_ci * @param callback the {@link OH_AVSessionCallback_OnToggleFavorite} to be unregistered. 67280922886Sopenharmony_ci * @return Function result code: 67380922886Sopenharmony_ci * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 67480922886Sopenharmony_ci * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 67580922886Sopenharmony_ci * {@link AV_SESSION_ERR_INVALID_PARAMETER} 67680922886Sopenharmony_ci * 1. The param of avsession is nullptr. 67780922886Sopenharmony_ci * 2. The param of callback is nullptr. 67880922886Sopenharmony_ci * @since 13 67980922886Sopenharmony_ci */ 68080922886Sopenharmony_ciAVSession_ErrCode OH_AVSession_UnregisterToggleFavoriteCallback(OH_AVSession* avsession, 68180922886Sopenharmony_ci OH_AVSessionCallback_OnToggleFavorite callback); 68280922886Sopenharmony_ci 68380922886Sopenharmony_ci#ifdef __cplusplus 68480922886Sopenharmony_ci} 68580922886Sopenharmony_ci#endif 68680922886Sopenharmony_ci 68780922886Sopenharmony_ci#endif // NATIVE_AVSESSION_H 68880922886Sopenharmony_ci/** @} */