1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup AVPlayer 18 * @{ 19 * 20 * @brief Provides APIs of Playback capability for Media Source. 21 * 22 * @Syscap SystemCapability.Multimedia.Media.AVPlayer 23 * @since 11 24 * @version 1.0 25 */ 26 27 /** 28 * @file avplayer.h 29 * 30 * @brief Defines the avplayer APIs. Uses the Native APIs provided by Media AVPlayer 31 * to play the media source. 32 * 33 * @kit MediaKit 34 * @library libavplayer.so 35 * @since 11 36 * @version 1.0 37 */ 38 39 #ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H 40 #define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H 41 42 #include <stdint.h> 43 #include <stdio.h> 44 #include "native_averrors.h" 45 #include "avplayer_base.h" 46 #include "native_audiostream_base.h" 47 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif 52 53 typedef struct MediaKeySession MediaKeySession; 54 typedef struct DRM_MediaKeySystemInfo DRM_MediaKeySystemInfo; 55 typedef void (*Player_MediaKeySystemInfoCallback)(OH_AVPlayer *play, DRM_MediaKeySystemInfo* mediaKeySystemInfo); 56 57 /** 58 * @brief Create a player 59 * @syscap SystemCapability.Multimedia.Media.AVPlayer 60 * @return Returns a pointer to an OH_AVPlayer instance 61 * @since 11 62 * @version 1.0 63 */ 64 OH_AVPlayer *OH_AVPlayer_Create(void); 65 66 /** 67 * @brief Sets the playback source for the player. The corresponding source can be http url 68 * @syscap SystemCapability.Multimedia.Media.AVPlayer 69 * @param player Pointer to an OH_AVPlayer instance 70 * @param url Indicates the playback source. 71 * @return Returns {@link AV_ERR_OK} if the url is set successfully; returns an error code defined 72 * in {@link native_averrors.h} otherwise. 73 * @since 11 74 * @version 1.0 75 */ 76 OH_AVErrCode OH_AVPlayer_SetURLSource(OH_AVPlayer *player, const char *url); 77 78 /** 79 * @brief Sets the playback media file descriptor source for the player. 80 * @syscap SystemCapability.Multimedia.Media.AVPlayer 81 * @param player Pointer to an OH_AVPlayer instance 82 * @param fd Indicates the file descriptor of media source. 83 * @param offset Indicates the offset of media source in file descriptor. 84 * @param size Indicates the size of media source. 85 * @return Returns {@link AV_ERR_OK} if the fd source is set successfully; returns an error code defined 86 * in {@link native_averrors.h} otherwise. 87 * @since 11 88 * @version 1.0 89 */ 90 OH_AVErrCode OH_AVPlayer_SetFDSource(OH_AVPlayer *player, int32_t fd, int64_t offset, int64_t size); 91 92 /** 93 * @brief Prepares the playback environment and buffers media data asynchronous. 94 * 95 * This function must be called after {@link SetSource}. 96 * 97 * @syscap SystemCapability.Multimedia.Media.AVPlayer 98 * @param player Pointer to an OH_AVPlayer instance 99 * @return Returns {@link AV_ERR_OK} if {@link Prepare} is successfully added to the task queue; 100 * returns an error code defined in {@link native_averrors.h} otherwise. 101 * @since 11 102 * @version 1.0 103 */ 104 OH_AVErrCode OH_AVPlayer_Prepare(OH_AVPlayer *player); 105 106 /** 107 * @brief Start playback. 108 * 109 * This function must be called after {@link Prepare}. If the player state is <b>Prepared</b>, 110 * this function is called to start playback. 111 * 112 * @syscap SystemCapability.Multimedia.Media.AVPlayer 113 * @param player Pointer to an OH_AVPlayer instance 114 * @return Returns {@link AV_ERR_OK} if the playback is started; otherwise returns an error code defined 115 * in {@link native_averrors.h} otherwise. 116 * @since 11 117 * @version 1.0 118 */ 119 OH_AVErrCode OH_AVPlayer_Play(OH_AVPlayer *player); 120 121 /** 122 * @brief Pauses playback. 123 * @syscap SystemCapability.Multimedia.Media.AVPlayer 124 * @param player Pointer to an OH_AVPlayer instance 125 * @return Returns {@link AV_ERR_OK} if {@link Pause} is successfully added to the task queue; 126 * returns an error code defined in {@link native_averrors.h} otherwise. 127 * @since 11 128 * @version 1.0 129 */ 130 OH_AVErrCode OH_AVPlayer_Pause(OH_AVPlayer *player); 131 132 /** 133 * @brief Stop playback. 134 * @syscap SystemCapability.Multimedia.Media.AVPlayer 135 * @param player Pointer to an OH_AVPlayer instance 136 * @return Returns {@link AV_ERR_OK} if {@link Stop} is successfully added to the task queue; 137 * returns an error code defined in {@link native_averrors.h} otherwise. 138 * @since 11 139 * @version 1.0 140 */ 141 OH_AVErrCode OH_AVPlayer_Stop(OH_AVPlayer *player); 142 143 /** 144 * @brief Restores the player to the initial state. 145 * 146 * After the function is called, add a playback source by calling {@link SetSource}, 147 * call {@link Play} to start playback again after {@link Prepare} is called. 148 * 149 * @syscap SystemCapability.Multimedia.Media.AVPlayer 150 * @param player Pointer to an OH_AVPlayer instance 151 * @return Returns {@link AV_ERR_OK} if {@link Reset} is successfully added to the task queue; 152 * returns an error code defined in {@link native_averrors.h} otherwise. 153 * @since 11 154 * @version 1.0 155 */ 156 OH_AVErrCode OH_AVPlayer_Reset(OH_AVPlayer *player); 157 158 /** 159 * @brief Releases player resources async 160 * 161 * Asynchronous release guarantees the performance 162 * but cannot ensure whether the surfacebuffer is released. 163 * The caller needs to ensure the life cycle security of the surface 164 * 165 * @syscap SystemCapability.Multimedia.Media.AVPlayer 166 * @param player Pointer to an OH_AVPlayer instance 167 * @return Returns {@link AV_ERR_OK} if {@link Release} is successfully added to the task queue; 168 * returns an error code defined in {@link native_averrors.h} otherwise. 169 * @since 11 170 * @version 1.0 171 */ 172 OH_AVErrCode OH_AVPlayer_Release(OH_AVPlayer *player); 173 174 /** 175 * @brief Releases player resources sync 176 * 177 * Synchronous release ensures effective release of surfacebuffer 178 * but this interface will take a long time (when the engine is not idle state) 179 * requiring the caller to design an asynchronous mechanism by itself 180 * 181 * @syscap SystemCapability.Multimedia.Media.AVPlayer 182 * @param player Pointer to an OH_AVPlayer instance 183 * @return Returns {@link AV_ERR_OK} if the playback is released; returns an error code defined 184 * in {@link native_averrors.h} otherwise. 185 * @since 11 186 * @version 1.0 187 */ 188 OH_AVErrCode OH_AVPlayer_ReleaseSync(OH_AVPlayer *player); 189 190 /** 191 * @brief Sets the volume of the player. 192 * 193 * This function can be used during playback or pause. The value <b>0</b> indicates no sound, 194 * and <b>1</b> indicates the original volume. If no audio device is started or no audio 195 * stream exists, the value <b>-1</b> is returned. 196 * 197 * @syscap SystemCapability.Multimedia.Media.AVPlayer 198 * @param player Pointer to an OH_AVPlayer instance 199 * @param leftVolume Indicates the target volume of the left audio channel to set, 200 * ranging from 0 to 1. each step is 0.01. 201 * @param rightVolume Indicates the target volume of the right audio channel to set, 202 * ranging from 0 to 1. each step is 0.01. 203 * @return Returns {@link AV_ERR_OK} if the volume is set; returns an error code defined 204 * in {@link native_averrors.h} otherwise. 205 * @since 11 206 * @version 1.0 207 */ 208 OH_AVErrCode OH_AVPlayer_SetVolume(OH_AVPlayer *player, float leftVolume, float rightVolume); 209 210 /** 211 * @brief Changes the playback position. 212 * 213 * This function can be used during play or pause. 214 * 215 * @syscap SystemCapability.Multimedia.Media.AVPlayer 216 * @param player Pointer to an OH_AVPlayer instance 217 * @param mSeconds Indicates the target playback position, accurate to milliseconds. 218 * @param mode Indicates the player seek mode. For details, see {@link AVPlayerSeekMode}. 219 * @return Returns {@link AV_ERR_OK} if the seek is done; returns an error code defined 220 * in {@link native_averrors.h} otherwise. 221 * @since 11 222 * @version 1.0 223 */ 224 OH_AVErrCode OH_AVPlayer_Seek(OH_AVPlayer *player, int32_t mSeconds, AVPlayerSeekMode mode); 225 226 /** 227 * @brief Obtains the playback position, accurate to millisecond. 228 * @syscap SystemCapability.Multimedia.Media.AVPlayer 229 * @param player Pointer to an OH_AVPlayer instance 230 * @param currentTime Indicates the playback position. 231 * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined 232 * in {@link native_averrors.h} otherwise. 233 * @since 11 234 * @version 1.0 235 */ 236 OH_AVErrCode OH_AVPlayer_GetCurrentTime(OH_AVPlayer *player, int32_t *currentTime); 237 238 /** 239 * @brief get the video width. 240 * @syscap SystemCapability.Multimedia.Media.AVPlayer 241 * @param player Pointer to an OH_AVPlayer instance 242 * @param videoWidth The video width 243 * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined 244 * in {@link native_averrors.h} otherwise. 245 * @since 11 246 * @version 1.0 247 */ 248 OH_AVErrCode OH_AVPlayer_GetVideoWidth(OH_AVPlayer *player, int32_t *videoWidth); 249 250 /** 251 * @brief get the video height. 252 * @syscap SystemCapability.Multimedia.Media.AVPlayer 253 * @param player Pointer to an OH_AVPlayer instance 254 * @param videoHeight The video height 255 * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined 256 * in {@link native_averrors.h} otherwise. 257 * @since 11 258 * @version 1.0 259 */ 260 OH_AVErrCode OH_AVPlayer_GetVideoHeight(OH_AVPlayer *player, int32_t *videoHeight); 261 262 /** 263 * @brief set the player playback rate 264 * @syscap SystemCapability.Multimedia.Media.AVPlayer 265 * @param player Pointer to an OH_AVPlayer instance 266 * @param speed the rate mode {@link AVPlaybackSpeed} which can set. 267 * @return Returns {@link AV_ERR_OK} if the playback rate is set successful; returns an error code defined 268 * in {@link native_averrors.h} otherwise. 269 * @since 11 270 * @version 1.0 271 */ 272 OH_AVErrCode OH_AVPlayer_SetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed speed); 273 274 /** 275 * @brief get the current player playback rate 276 * @syscap SystemCapability.Multimedia.Media.AVPlayer 277 * @param player Pointer to an OH_AVPlayer instance 278 * @param speed the rate mode {@link AVPlaybackSpeed} which can get. 279 * @return Returns {@link AV_ERR_OK} if the current player playback rate is get; returns an error code defined 280 * in {@link native_averrors.h} otherwise. 281 * @since 11 282 * @version 1.0 283 */ 284 OH_AVErrCode OH_AVPlayer_GetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed *speed); 285 286 /** 287 * @brief Set the renderer information of the player's audio renderer 288 * @param player Pointer to an OH_AVPlayer instance 289 * @param streamUsage The value {@link OH_AudioStream_Usage} used for the stream usage of the player audio render. 290 * @return Function result code. 291 * {@link AV_ERR_OK} if the execution is successful. 292 * {@link AV_ERR_INVALID_VAL} if input player is nullptr or streamUsage value is invalid. 293 * @since 12 294 * @version 1.0 295 */ 296 OH_AVErrCode OH_AVPlayer_SetAudioRendererInfo(OH_AVPlayer *player, OH_AudioStream_Usage streamUsage); 297 298 /** 299 * @brief Set the volume mode of the player's audio renderer 300 * @param player Pointer to an OH_AVPlayer instance 301 * @param mode The value {@link OH_AudioStream_VolumeMode} used for the volume mode of the player audio render. 302 * @return Function result code. 303 * {@link AV_ERR_OK} if the execution is successful. 304 * {@link AV_ERR_INVALID_VAL} if input player is nullptr or streamUsage value is invalid. 305 * @since 16 306 * @version 1.0 307 */ 308 OH_AVErrCode OH_AVPlayer_SetVolumeMode(OH_AVPlayer *player, OH_AudioStream_VolumeMode mode); 309 310 /** 311 * @brief Set the interruption mode of the player's audio stream 312 * @param player Pointer to an OH_AVPlayer instance 313 * @param interruptMode The value {@link OH_AudioInterrupt_Mode} used for the interruption mode of 314 * the player audio stream. 315 * @return Function result code. 316 * {@link AV_ERR_OK} if the execution is successful. 317 * {@link AV_ERR_INVALID_VAL} if input player is nullptr or interruptMode value is invalid. 318 * @since 12 319 * @version 1.0 320 */ 321 OH_AVErrCode OH_AVPlayer_SetAudioInterruptMode(OH_AVPlayer *player, OH_AudioInterrupt_Mode interruptMode); 322 323 /** 324 * @brief Set the effect mode of the player's audio stream 325 * @param player Pointer to an OH_AVPlayer instance 326 * @param effectMode The value {@link OH_AudioStream_AudioEffectMode} used for the effect mode of 327 * the player audio stream. 328 * @return Function result code. 329 * {@link AV_ERR_OK} if the execution is successful. 330 * {@link AV_ERR_INVALID_VAL} if input player is nullptr or effectMode value is invalid. 331 * @since 12 332 * @version 1.0 333 */ 334 OH_AVErrCode OH_AVPlayer_SetAudioEffectMode(OH_AVPlayer *player, OH_AudioStream_AudioEffectMode effectMode); 335 336 /** 337 * @brief set the bit rate use for hls player 338 * 339 * the playback bitrate expressed in bits per second, expressed in bits per second, 340 * which is only valid for HLS protocol network flow. By default, 341 * the player will select the appropriate bit rate and speed according to the network connection. 342 * report the effective bit rate linked list by "INFO_TYPE_BITRATE_COLLECT" 343 * set and select the specified bit rate, and select the bit rate that is less than and closest 344 * to the specified bit rate for playback. When ready, read it to query the currently selected bit rate. 345 * 346 * @syscap SystemCapability.Multimedia.Media.AVPlayer 347 * @param player Pointer to an OH_AVPlayer instance 348 * @param bitRate the bit rate, The unit is bps. 349 * @return Returns {@link AV_ERR_OK} if the bit rate is set successfully; returns an error code defined 350 * in {@link native_averrors.h} otherwise. 351 * @since 11 352 * @version 1.0 353 */ 354 OH_AVErrCode OH_AVPlayer_SelectBitRate(OH_AVPlayer *player, uint32_t bitRate); 355 356 /** 357 * @brief Method to set the surface. 358 * @syscap SystemCapability.Multimedia.Media.AVPlayer 359 * @param player Pointer to an OH_AVPlayer instance 360 * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow} 361 * @return Returns {@link AV_ERR_OK} if the surface is set; returns an error code defined 362 * in {@link native_averrors.h} otherwise. 363 * @since 11 364 * @version 1.0 365 */ 366 OH_AVErrCode OH_AVPlayer_SetVideoSurface(OH_AVPlayer *player, OHNativeWindow *window); 367 368 /** 369 * @brief Obtains the total duration of media files, accurate to milliseconds. 370 * @syscap SystemCapability.Multimedia.Media.AVPlayer 371 * @param player Pointer to an OH_AVPlayer instance 372 * @param duration Indicates the total duration of media files. 373 * @return Returns {@link AV_ERR_OK} if the current duration is get; returns an error code defined 374 * in {@link native_averrors.h} otherwise. 375 * @since 11 376 * @version 1.0 377 */ 378 OH_AVErrCode OH_AVPlayer_GetDuration(OH_AVPlayer *player, int32_t *duration); 379 380 /** 381 * @brief get current playback state. 382 * @syscap SystemCapability.Multimedia.Media.AVPlayer 383 * @param player Pointer to an OH_AVPlayer instance 384 * @param state the current playback state 385 * @return Returns {@link AV_ERR_OK} if the current duration is get; returns an error code defined 386 * in {@link native_averrors.h} otherwise. 387 * @since 11 388 * @version 1.0 389 */ 390 OH_AVErrCode OH_AVPlayer_GetState(OH_AVPlayer *player, AVPlayerState *state); 391 392 /** 393 * @brief Checks whether the player is playing. 394 * @syscap SystemCapability.Multimedia.Media.AVPlayer 395 * @param player Pointer to an OH_AVPlayer instance 396 * @return Returns true if the playback is playing; false otherwise. 397 * @since 11 398 * @version 1.0 399 */ 400 bool OH_AVPlayer_IsPlaying(OH_AVPlayer *player); 401 402 /** 403 * @brief Returns the value whether single looping is enabled or not . 404 * @syscap SystemCapability.Multimedia.Media.AVPlayer 405 * @param player Pointer to an OH_AVPlayer instance 406 * @return Returns true if the playback is single looping; false otherwise. 407 * @since 11 408 * @version 1.0 409 */ 410 bool OH_AVPlayer_IsLooping(OH_AVPlayer *player); 411 412 /** 413 * @brief Enables single looping of the media playback. 414 * @syscap SystemCapability.Multimedia.Media.AVPlayer 415 * @param player Pointer to an OH_AVPlayer instance 416 * @param loop The switch to set loop 417 * @return Returns {@link AV_ERR_OK} if the single looping is set; returns an error code defined 418 * in {@link native_averrors.h} otherwise. 419 * @since 11 420 * @version 1.0 421 */ 422 OH_AVErrCode OH_AVPlayer_SetLooping(OH_AVPlayer *player, bool loop); 423 424 /** 425 * @brief Method to set player callback. 426 * @syscap SystemCapability.Multimedia.Media.AVPlayer 427 * @param player Pointer to an OH_AVPlayer instance 428 * @param callback object pointer. 429 * @return Returns {@link AV_ERR_OK} if the playercallback is set; returns an error code defined 430 * in {@link native_averrors.h} otherwise. 431 * @since 11 432 * @deprecated since 12 433 * @useinstead {@link OH_AVPlayer_SetPlayerOnInfoCallback} {@link OH_AVPlayer_SetPlayerOnErrorCallback} 434 * @version 1.0 435 */ 436 OH_AVErrCode OH_AVPlayer_SetPlayerCallback(OH_AVPlayer *player, AVPlayerCallback callback); 437 438 /** 439 * @brief Select audio or subtitle track. 440 * 441 * By default, the first audio stream with data is played, and the subtitle track is not played. 442 * After the settings take effect, the original track will become invalid. Please set subtitles 443 * in prepared/playing/paused/completed state and set audio tracks in prepared state. 444 * 445 * @syscap SystemCapability.Multimedia.Media.AVPlayer 446 * @param player Pointer to an OH_AVPlayer instance 447 * @param index Track index 448 * @return Returns {@link AV_ERR_OK} if selected successfully; returns an error code defined 449 * in {@link native_averrors.h} otherwise. 450 * @since 11 451 * @version 1.0 452 */ 453 OH_AVErrCode OH_AVPlayer_SelectTrack(OH_AVPlayer *player, int32_t index); 454 455 /** 456 * @brief Deselect the current audio or subtitle track. 457 * 458 * After audio is deselected, the default track will be played, and after subtitles are deselected, 459 * they will not be played. Please set subtitles in prepared/playing/paused/completed state and set 460 * audio tracks in prepared state. 461 * 462 * @syscap SystemCapability.Multimedia.Media.AVPlayer 463 * @param player Pointer to an OH_AVPlayer instance 464 * @param index Track index 465 * @return Returns {@link AV_ERR_OK} if selected successfully; returns an error code defined 466 * in {@link native_averrors.h} otherwise. 467 * @since 11 468 * @version 1.0 469 */ 470 OH_AVErrCode OH_AVPlayer_DeselectTrack(OH_AVPlayer *player, int32_t index); 471 472 /** 473 * @brief Obtain the currently effective track index. 474 * 475 * Please get it in the prepared/playing/paused/completed state. 476 * 477 * @syscap SystemCapability.Multimedia.Media.AVPlayer 478 * @param player Pointer to an OH_AVPlayer instance 479 * @param trackType Media type. 480 * @param index Track index 481 * @return Returns {@link AV_ERR_OK} if the track index is get; returns an error code defined 482 * in {@link native_averrors.h} otherwise. 483 * @since 11 484 * @version 1.0 485 */ 486 OH_AVErrCode OH_AVPlayer_GetCurrentTrack(OH_AVPlayer *player, int32_t trackType, int32_t *index); 487 488 /** 489 * @brief Method to set player media key system info callback. 490 * @syscap SystemCapability.Multimedia.Media.AVPlayer 491 * @param player Pointer to an OH_AVPlayer instance 492 * @param callback object pointer. 493 * @return Returns {@link AV_ERR_OK} if the drm info callback is set; returns an error code defined 494 * in {@link native_averrors.h} otherwise. 495 * @since 12 496 * @version 1.0 497 */ 498 OH_AVErrCode OH_AVPlayer_SetMediaKeySystemInfoCallback(OH_AVPlayer *player, 499 Player_MediaKeySystemInfoCallback callback); 500 501 /** 502 * @brief Obtains media key system info to create media key session. 503 * @syscap SystemCapability.Multimedia.Media.AVPlayer 504 * @param player Pointer to an OH_AVPlayer instance 505 * @param mediaKeySystemInfo Media key system info. 506 * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined 507 * in {@link native_averrors.h} otherwise. 508 * @since 12 509 * @version 1.0 510 */ 511 OH_AVErrCode OH_AVPlayer_GetMediaKeySystemInfo(OH_AVPlayer *player, DRM_MediaKeySystemInfo *mediaKeySystemInfo); 512 513 /** 514 * @brief Set decryption info. 515 * 516 * @syscap SystemCapability.Multimedia.Media.AVPlayer 517 * @param player Pointer to an OH_AVPlayer instance 518 * @param mediaKeySession A media key session instance with decryption function. 519 * @param secureVideoPath Require secure decoder or not. 520 * @return Returns AV_ERR_OK if the execution is successful, 521 * otherwise returns a specific error code, refer to {@link OH_AVErrCode} 522 * @since 12 523 * @version 1.0 524 */ 525 OH_AVErrCode OH_AVPlayer_SetDecryptionConfig(OH_AVPlayer *player, MediaKeySession *mediaKeySession, 526 bool secureVideoPath); 527 528 /** 529 * @brief Method to set player information notify callback. 530 * @syscap SystemCapability.Multimedia.Media.AVPlayer 531 * @param player Pointer to an OH_AVPlayer instance. 532 * @param callback Pointer to callback function, nullptr indicates unregister callback. 533 * @param userData Pointer to user specific data. 534 * @return Function result code. 535 * {@link AV_ERR_OK} if the execution is successful. 536 * {@link AV_ERR_INVALID_VAL} if input player is null or player SetOnInfoCallback failed. 537 * @since 12 538 */ 539 OH_AVErrCode OH_AVPlayer_SetOnInfoCallback(OH_AVPlayer *player, OH_AVPlayerOnInfoCallback callback, void *userData); 540 541 /** 542 * @brief Method to set player error callback. 543 * @syscap SystemCapability.Multimedia.Media.AVPlayer 544 * @param player Pointer to an OH_AVPlayer instance. 545 * @param callback Pointer to callback function, nullptr indicates unregister callback. 546 * @param userData Pointer to user specific data. 547 * @return Function result code. 548 * {@link AV_ERR_OK} if the execution is successful. 549 * {@link AV_ERR_INVALID_VAL} if input player is null or player SetOnErrorCallback failed. 550 * @since 12 551 */ 552 OH_AVErrCode OH_AVPlayer_SetOnErrorCallback(OH_AVPlayer *player, OH_AVPlayerOnErrorCallback callback, void *userData); 553 554 #ifdef __cplusplus 555 } 556 #endif 557 558 #endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H 559