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